In this article, we will cover how to add signal emitters to Timeline that will allow you to call methods or functions from script. This simple example will just have the Timeline pause but the possibilities are endless when you can trigger different things using script and Timeline.
Signal Emitters Setup
In Timeline you want to click on the Show Maker icon (thumb tack) to open up the Markers track. Right-click on the track and Add Signal Emitter
In the Timeline, the Signal Emitter marker is added, but a caution sign appears.
This is because there is no Signal or Signal Receiver on the emitter, so we will need to create one.
You will want to create a Signals Folder for the project and name the signal.
The Signal Receiver will be the game object that holds the Method you want to call.
Controlling Timeline With Script
We are going to add a script to the game object that is the Signal Receiver (Director_Zombie).
We will need to use the UnityEngine.Playable library and we will create a Playable Director class variable. The Playable Director is the component that controls the Timeline. We will get the Playable Director component and assign it to our variable (_director).
This is where you will script what you want to happen when the Signal Emitter is reached on the Timeline. You will create a public method and place your code into the method. For this example, I will have the Timeline pause.
Now, the method or function created in the script can be found in the Signal Receiver and will be called when it is reached in the Timeline.