Unity’s Timeline: Signal Emitters
Today, I will go over how signal emitters read C# scripts in Timeline!
What are Signal Emitters?
Signal emitters are a way to add events that in Timeline. Adding events like sending the player to the next level after a victory cutscene! That’s pretty sweet!
Adding your Signal Emitters
On the left side of Timeline, click the thumbtack button. That will dropdown a tab that says “Markers”. Now find the time you wish to add your event, right click it, and click Add Signal Emitter. That will add a small banner looking icon with a warning sign on it.
Setting Up that Signal Emitter
Click the signal emitter and go to the inspector. Click the box where it says Emit Signal then Create Signal.
That will ask you to choose where to save it. I would create a folder just for signals.
Now press the Add Signal Receiver button below. Now drag in the object with the script that will be doing the event. We will be coming back to this soon.
Code to Change Scenes
The signal receiver can read and run code from the script attached to the object you added to the receiver. This is pretty simple to implement.
- Note: If you don’t make the method public, the receiver can’t find it. I learned that the hard way.
That is all you need in your code though. I just added 3 lines of code:
- The library
UnityEngine.SceneManagement— don’t forget this.
- The method
- And the code to load a new scene!
Signal Emitters are a neat way to implement events with little code!
Next up, time to learn how to add character animations to Timeline!
Thank you for your time!