Using Signal Emitters in Timeline to Access C# Scripts

Chris Hilton
4 min readFeb 17, 2022

--

Objective: To understand how to use Signal Emitters in Timeline to access our C# scripts.

Following on from the previous article that looked at what a Signal Emitter is, let’s take this information we have learnt and use it in action.

To set the scene, what I am looking to achieve here is using 2 simple cubes (as shown below) to show what happens to them when they receive an emitted signal from Timeline to our script.

Basic scene setup

Step 1 — Create Game Objects and New Timeline on Director

Let’s start by creating our 2 cubes and at the same time create a new script that is going to be attached to both cubes but will have different methods called.

Let’s also create a new Timeline onto an empty game object and rename this Director. A PlayableDirector() component will automatically be added when creating the new Timeline. However, we will still need a signal receiver to be added later.

So it should be looking something like this now:

Basic scene setup

Within the script I am simple going to have two different Debug.Log() methods called when the signal emitter is activated/received. Make sure they are public methods so we can call them from within Unity.

Script that is added to both of our cubes

Step 2 — Creating Signal Emitters and Signal Assets

Let’s now create the two signal emitters in Timeline as shown below:

Adding signal emitters to Timeline

When right-clicking in this section make sure to choose ‘Add Signal Emitter’. You will be met with an error symbol on the icon and this is because we haven’t added/created our signal asset.

Signal Emit errors — Create new signal asset to resolve. Also add signal receiver

Click on the drop down box and select ‘Create Signal’. Name it and save it somewhere in your Project.

Make sure to also click the button Add Signal Receiver’ and this will automatically create one on the Director game object for you.

Step 3 — Drag Game Objects into Timeline and Create Activation Track

Now this can be a different type of track if you like, this is just how I set it up.

This example can be shown above.

Step 4 — Creating our Reactions to the Emitted Signal Using Signal Receiver

On the Director game object in the Inspector window, we can now see we have our two signal emitters set up for Signal01 and Signal02.

Signal emitters set up on the signal receiver — Need to add source game objects and a reaction

From here we need to add a source game object and a reaction (a function call). So I am going to drag Cube01 into the Signal01 empty box and Cube02 for Signal02 from the Hierarchy:

Adding in source game objects for our signals

Next, click on the drop down boxes where it says ‘No Function’ and navigate your way through ‘No Function’ → ‘Cube01’ → ‘Cube01Call()’. This is going to call our public method that we setup earlier. Now do the same for Signal02.

Adding in the function (reaction)

Now we are complete, let’s hit Play and make sure that our signal emits are being received in the Console window:

Testing our signal emits

--

--

Chris Hilton
Chris Hilton

Written by Chris Hilton

Passionate Unity Game Developer

No responses yet