Using Signal Emitters to Access C# Scripts

Signal Emitters give one the ability to call methods/functions along your Timeline's sequence!

Similarly like adding Events in the Animation window, those Events will connect to a function. To get started, create a Timeline. Create a cube object and a capsule object. For each object, let's write a script: one called Cube and the other called Capsule.

In each script, write a method called PrintMessage that just has a debug line saying each script name. Right click inside Timeline and click Signal Track twice so you end up with 2 Signal Tracks. Drag the cube into the first Signal Track’s field in Timeline and the capsule into the second Signal Track’s field.

Then right click on the first track and select Add Signal Emitter. While selecting the Signal Emitter in the inspector, click Create Signal... and name it Cube Signal. Also click the Add Reaction button. In the New Signal field, drag in the cube object and select the Function dropdown -> Cube - > Cube.PrintMessage.

Further down the Timeline, right click the marker bar again create another Signal Emitter. Click on the Signal Emitter, click the Emit Signal dropdown and select Create Signal... and name the file Capsule Signal. Drag in the capsule object into the New Signal field and select the Capsule.PrintMessage function.

Now when we play our Timeline while having the Signals play in the Editor and Runtime, we can see each method is called within each script at the times we set. This is a simple example, but can be expanded in a variety of ways for your game!

Previous
Previous

Character Animations in Timeline

Next
Next

What is a Control Track?