In Unity 2019.1, we introduced Timeline Signals.
Timeline Signals allow us to establish a communication channel
between the Timeline and outside systems in our project.
A Timeline Signal is constructed from three pieces;
a Signal Asset, a Signal Emitter, and a Signal Receiver.
The Signal Asset is an asset stored in our project
that defines our signal event.
We store the signal as an asset, as it allows us to easily create,
order, and rename signals without losing a reference to them.
It also allows multiple users to work with signals simultaneously.
One team member can be constructing the signal on the Timeline,
while another can be hooking up the reactions
to these signals elsewhere in the project,
simply by referencing the same Signal Asset.
Similarly, it means that multiple Timelines
can use the same Signal Asset at once.
The Signal Emitter is a marker on our Timeline
that dispatches a Signal Asset.
There are two ways to emit a signal;
the first is to emit the signal from the Timeline itself.
To do this, we click the Pin button
in the Timeline window to show markers,
and then right-click at the point in the Timeline
where we'd like to add our new Signal Emitter.
We can then choose to create an emitter from a new Signal Asset,
or create an emitter
from an existing Signal Asset in our project.
Alternatively, we can drag and drop an existing Signal Asset
onto the marker area to create a Signal Emitter.
We can also create Signal Emitters by using a Signal Emitter track.
The Signal Emitter track binds the signals
to a GameObject in our Timeline.
For example, here I'm using Signal Emitters
on this door GameObject
to emit my door trigger signal.
The final piece of the Timeline Signal system
is the Signal Receiver.
As the name implies,
the Signal Receiver Component listens out for signals,
and then reacts when it receives them.
If the Signal Emitter is on the Timeline itself,
the GameObject that has the playable director Component
used to play the Timeline will receive the signals.
If the Signal Emitter is on a track,
the GameObject bound to the track will receive the signals.
If I select the Door, you can see that the Signal Receiver Component
is linked to our DoorTrigger signal, and is ready to react.
Let's see this in action.
Timeline Signals are a great way to control gameplay systems
from sequenced events.
In this cut scene, our character runs over to the panel,
and using Timeline Signals, sends a reaction to the hologram,
causing it to randomly change color.
Our character then runs over to the door
and attempts to go through it.
However, due to the current game state,
the door remains closed.
So let's create a reaction on the door
that toggles a parameter on the Animator.
We can select the marker
and inspect the Signal Receiver Component for the door
from inside of our Timeline.
Let's add a new reaction on the DoorTrigger signal.
Let's choose Animator > SetTrigger,
and let's use the "toggleDoor" parameter.
Now, whenever the DoorTrigger signal is emitted by our Timeline,
the Animator on the door will change this toggle.
As you can see, when our character approaches the door,
the door opens, our character runs through the door,
and the door then closes again.
It's worth noting that Signal Receivers
can handle multiple Timeline Signals.
Let's take a look at the Signal Receiver
on our Timeline.
I'd like the hologram to reset back to its default color of blue
before the character runs over to the door.
Let's Add a new Reaction in the Inspector,
and choose our ResetColor signal.
Now let's add a new action and assign it to our hologram.
Then let's tell the color to reset whenever the signal is received.
Now, back in our Timeline, we can add a new marker.
We'll choose Add Signal Emitter > Add Signal Emitter From Signal Asset,
and let's choose our ResetColor signal.
When we play the Scene, our signal is now emitted,
and our hologram resets
before our character runs away from the panel.
As you can see, Timeline Signals are flexible and easy to use.
So if you'd like to explore Timeline Signals
and what you can do with them,
you can download the free example project
using the link in the description below,
and give it a try for yourself.
Thanks for watching.