Game Development Reference
In-Depth Information
Refactoring our work
Now that we have a fully functional system for loading and unloading scene files, we
will dedicate our attention to the integration and refactoring of the remaining GameOb-
jects, hierarchies, and scripts.
The pop-up system
To refactor our pop-up system, perform the following steps to complete the moving of
our game content from the
testbed
scene file to the
MAIN
scene file.
Updating level 3 pop ups
Let's begin by refactoring the pop-up panel system:
1. Under
_global
, ensure that the player (named
Player1
), camera (named
MainCamera
), and game (named
Game
) child objects can be found. Also
make sure that a GameObject of type
GUITexture
named
score
is present
as shown in the following screenshot:
2. We will change the behavior of the pop ups that are shown at the start and
completion of each level. Rather than instantiating them from a Prefab, we will
add them at design time in the editor and selectively activate and deactivate
them as necessary. This will make the task of refactoring the pop-up system
more straightforward.
3. Load the
TESTBED3
scene file. Find the
MainCamera
GameObject, and open
the
Hierarchy
tab to display the UI pop up's child objects.
4. Press the
Shift
key, select all of the pop ups, and copy them with
Ctrl
+
C
.