Game Development Reference
In-Depth Information
the button's action. This way, the button will instance a GameObject from this
Prefab on click.
6. Change the second action of this button to
EnableOb-
ject(setupLevel2Prefab)
. In a similar fashion as earlier, set the refer-
ence to
setupLevel2Prefab
by dragging-and-dropping it from the
Project
tab directly in to the data field of the button's action. This way, the button will
instance a GameObject from the Prefab on click.
7. Change the third action to
CameraLookPlayer()
so that the view will track
the hero as the character moves in the world.
8. Change the last action of this button to
HideGameOb-
ject(popup_Level2Start)
to hide this panel while still leaving it at-
tached to the
MainCamera
GameObject persistent in
_global
.
9. Next, select the
popup_Level2Finished
button, and open up the
Button1
hierarchy.
10. Change the first action of this button to
CameraLookUp()
. This will orient
the camera to a point above the player so that the subsequent pop ups will
display in a visually appealing way.
11. Change the next action of this button to
LoadLevel3
(to tell
GameMgr
to
unload
Level2
by destroying the root GameObject instance, and then load
Level3
). Throughout this process,
_global
and all of its child objects will
be preserved.
12. Change the last action of this button to
HideGameOb-
ject(popup_Level2Finish)
. This will disable the rendering of this panel
while still leaving it attached to the
MainCamera
GameObject persistent in
_global
.
13. Lastly, select the
popup_Level2Repeat
panel, and open the
Button1
hier-
archy.
14. Change the first action to
CameraLookUp()
to point the camera towards the
sky (which makes the pop ups show up in a visually appealing way).
15. Change the next action to
LoadLevel2
. This will tell the
GameMgr
script to
destroy the
_level2
GameObject (and all of its children), and then reload
the
_level2
GameObject, thereby resetting its state.
Congratulations! You have finished updating the pop ups for level 2. Let's move on
to the pop ups of level 1.