Game Development Reference
In-Depth Information
Tip If you wish to add any characters, you should drag the assets rather than the prefabs into the scene to
avoid any animation or controller script issues.
12.
Save the scene.
13.
Add it to the Build Settings, and move it up above the GardenLevel1.
14.
The Build levels should now look as shown in Figure 10-39 .
Figure 10-39. The final level order in the Build Settings
15.
Click Build and select Overwrite when the dialog appears.
Because you are using names rather than index numbers to load the levels through your scripting,
the order (other than the starting level, index 0) isn't important.
Retaining Data
With all of the new menus loaded and the game built, you should be able to test navigation between
them and some of their functionality.
1.
Load the StartMenu.
2.
Click Play, and the test menus to see how they handle.
The most obvious issue is that the garden scene restarts every time you select Play Game from the
Main menu. In this simple game, you won't be saving games, so you don't need to offer a “load
previous game” option. You will, however, have to save some of the data from the garden level when
the player is visiting the menu layers.
DontDestroyOnLoad
If it was simply a matter of retaining the character's transform and a score, things would be fairly
simple. Unfortunately, all of those pesky, instantiated zombie bunnies have to be accounted for.
Rather than just passing on a few choice bits of data, you will carry the pertinent gameObjects
through whenever you change levels, setting them as active or inactive according to level. This is
where moving the garden level to the end of the level list works nicely.
 
Search WWH ::




Custom Search