September 2013
Beginner
292 pages
6h 19m
English
In the code block of the Awake() method, we're going to check if the GameManager GameObject already exists. If it doesn't, we'll save it to a variable and tell Unity not to destroy it when any other Scene level is loaded. If it does already exist, we'll tell Unity to destroy any new GameManager GameObjects created.
Insert the new code as shown in the following steps:
static variable on line 9.Awake() method at lines 11 through 22 as shown in the following screenshot:
An analysis of the code shown in the preceding screenshot is as follows:On the StateManager ...