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:

  1. Remove the StateManager Component from the Main Camera.
  2. Make a new Scene by selecting on the menu File | New Scene.
  3. In the menu, navigate to GameObject | Create Empty.
  4. Rename the GameObject to GameManager.
  5. Add the StateManager script to the GameManager.
  6. In the menu, navigate to File | Save Scene as....
  7. Save the Scene as BeginningScene in the Scenes folder.
  8. Click on Play to verify if the State Machine is working as before.

At this point, after clicking on

Get Learning C# by Developing Games with Unity 3D Beginner's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.