Time for action – setting up another Scene
We're going to create a new Scene for BeginState
. As a result, we don't want the StateManager
object to be a Component of the Main Camera anymore. We'll add StateManager
to another GameObject in the new Scene. In order to do so, perform the following steps:
Remove the
StateManager
Component from the Main Camera.Make a new Scene by selecting on the menu File | New Scene.
In the menu, navigate to GameObject | Create Empty.
Rename the GameObject to GameManager.
Add the StateManager script to the GameManager.
In the menu, navigate to File | Save Scene as....
Save the Scene as
BeginningScene
in theScenes
folder.Click on Play to verify if the State Machine is working as before.
At this point, after clicking on Play, you will see the Press to Play button and the countdown timer in your Scene.
Add the Scenes to the Build Settings as shown in the following steps:
In the menu, navigate to File | Build Settings....
In the Build Settings window, click on the Add Current...