Game Development Reference
In-Depth Information
Creating a global scene
The global scene file will contain all persistent GameObjects and scripts that have a
lifespan of the entire game. To create this file, perform the following steps:
1. Create a new empty GameObject, and name it _global .
2. Set its position to ( 0 , 0 , 0 ). Doing this before we drag-and-drop objects be-
neath it will ensure that the world space positions of the child objects will stay
the same as they were previously.
3. Drag-and-drop the following GameObjects beneath the _global GameOb-
ject. These will eventually be moved to a new scene file named MAIN as
shown in the following screenshot.
MainCamera
MissionMgr
Player
4. Rename MissionMgr to Game . We rename it because we are expanding
the responsibilities of this object beyond just MissionMgr ; we will be adding
another script to this object to increase its responsibilities in the game, so a
more generic name is appropriate.
5. Create a new script, and name it GameMgr . Attach it to the object named
Game . We will implement this script later in this chapter.
6. Create a new script, and name it PlayerData . Attach it to the object named
Game . We will implement this script later in this chapter.
7. Create a new scene by selecting New Scene from the File drop-down menu.
This will be the new starting scene for our game going forward. Name it
MAIN .
Search WWH ::




Custom Search