Game Development Reference
In-Depth Information
Implementing
a
system
to
connect
object references
Level 1 signals level 2 to load when the Level 1 completes pop up's Next button is
pressed; it signals for the _level1 GameObject to be destroyed and the _level2
GameObject to be loaded from the LEVEL2 scene file. We must refactor the start-
up logic of _level2 so that we can find and connect some object references to
GameObjects in the _global hierarchy.
1. Create a new script named Level2Extras , and attach an instance of it to
the _level2 GameObject. This script will be used to directly access certain
GameObjects inside _level2 for enabling and disabling.
2. Give the Level2Extras script the following three public GameObject refer-
ences; these are the assorted GameObjects that this script will be in charge
of activating:
public GameObject raceStartup;
public GameObject setupLevel2;
public GameObject LevelLogicObj;
3. Drag-and-drop the LevelLogicObj object from the _level2 GameObject
hierarchy into the LevelLogicObj reference of the Level2Extras script.
4. Drag-and-drop the setupLevel2 GameObject from the _level2 GameOb-
ject hierarchy into the setupLevel2 reference of the Level2Extras script.
5. Drag-and-drop the raceStartup GameObject from the _level2 GameOb-
ject hierarchy into the raceStartup reference of the Level2Extras script.
6. At this point your Level2Extras script should look something like the follow-
ing:
Search WWH ::




Custom Search