Reader small image

You're reading from  Game Development Patterns with Unity 2021 - Second Edition

Product typeBook
Published inJul 2021
Reading LevelBeginner
PublisherPackt
ISBN-139781800200814
Edition2nd Edition
Languages
Tools
Right arrow
Author (1)
David Baron
David Baron
author image
David Baron

David Baron is a game developer with over 15 years of experience in the industry. He has worked for some well-known AAA, mobile, and indie game studios in Montreal, Canada. His skill set includes programming, design, and 3D art. As a programmer, he has worked on various games for various platforms, including virtual reality, mobile, and consoles.
Read more about David Baron

Right arrow

Testing the Game Manager

If you wish to test the classes you just wrote in your instance of Unity, then you should go through the following steps:

  1. Create a new empty Unity scene called Init.
  2. In the Init scene, add an empty GameObject and attach the GameManager class to it.
  3. Create several empty Unity scenes, as many as you wish.
  4. In Build Settings under the File menu, add the Init scene at index 0:

Figure 4.3 – Build Settings
  1. Then add your new empty Unity scenes to the Build Settings list, as many as you wish.

If you now start the Init scene, you should see a GUI button named Next Scene as in the following screenshot:

Figure 4.4  Screenshot of the code example in action

If you click on the Next Scene button, you will cycle through each of the scenes you added in Build Settings, and the GUI will persist onscreen. If you stop running the game, you should see in the console log the duration of your session. If you try to add additional GameManagers...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Game Development Patterns with Unity 2021 - Second Edition
Published in: Jul 2021Publisher: PacktISBN-13: 9781800200814

Author (1)

author image
David Baron

David Baron is a game developer with over 15 years of experience in the industry. He has worked for some well-known AAA, mobile, and indie game studios in Montreal, Canada. His skill set includes programming, design, and 3D art. As a programmer, he has worked on various games for various platforms, including virtual reality, mobile, and consoles.
Read more about David Baron