Objective: Use Signal Emitters to change scenes.
We can use signals from Timeline to access a script to complete some behavior. For today's article we will use the Signal Emitters to change scenes. First lets create another scene in the project window.
Next go to File → Build Settings.
Add the current and new scenes into the top portion of the Build Setting window.
Now onto the Timeline, I created a simple light flickering and swaying animation for a challenge. At the end of this Timeline we will Add a Signal Emitter.
The Signal Emitter looks like a white tab on the track it was added to. It will have a Caution symbol because there is no signal or receiver.
With it selected in the inspection we will select Create Signal. Save it where you would like.
Next Add Signal Receiver.
The Signal Receiver will need an object that has a script on it to load the next scene. For an example, we will create an Empty Object and add on a newly created script. I called mine LoadNextScene.
In the Script we will need to call the next scene. To do this we will need to use the SceneManagement namespace.
We will create a public method that calls SceneManager.LoadScene(1);. We add 1 into the parentheses because the next scene in build setting has the index of one. You could call by name as well.
Back on the Signal Emitter we will need to assign the Game Object that has the script.
Select No Function → LoadNextScene → NextScene().
Now if we play the game we can see it in action.
Signal Emitters can be used for a lot of different things. For what we covered today could be very useful to load the next level after a boss fight ending animation.
Thank you for reading and have a wonderful day!