O'Reilly logo

Learning C# by Developing Games with Unity 3D Beginner's Guide by Terry Norton

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action – adding the code to change the Scenes

We'll add a single line of code in BeginState and in LostState to change Scenes.

  1. In BeginState, add Application.LoadLevel("Scene1"); into the Switch() method on line 42 as shown in the following screenshot:
    Time for action – adding the code to change the Scenes
  2. In LostState, add Application.LoadLevel("BeginningScene"); into the StateUpdate() method on line 20 as shown in the following screenshot:
    Time for action – adding the code to change the Scenes

    If earlier in this chapter you changed WonState to switch to PlayState instead of starting over with BeginState, we're ready to test our State Machine again. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required