The Game Manager

In the previous chapter, we introduced the GameMangerScript, but even after the second implementation of waypoints, we have left this script empty with no use. However, we do indeed need a game manager in our game to handle a couple of things. So, in case you have erased it from the last chapter, recreate it, along with a game object in the scene with such a script attached (the same way as if you erased the reference from the PandaScript, because we will need it later on).

We will use the Game Manager as a hub for exchanging information between the player's health and the Pandas. In fact, the Game Manager will spawn Pandas in the scene divided into waves, and it's the only script to be aware of when the level starts and finishes ...

Get Getting Started with Unity 5.x 2D Game Development 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.