Game Development Reference
In-Depth Information
Step 26: Turn off the trigger's Mesh Renderer components. Select each
trigger in the Hierarchy and then in the Inspector panel, and click off Mesh
Renderer. This will make the triggers disappear from view.
Why?
They are no longer visible, but still functional. When we were building
the mechanism it was handy to have the triggers visible because it made
placement easier, and it made it easier to see when we actually had hit a
trigger when playing the game. However, obviously we don't want these
seen in the final game, so once we're confident that they are working,
making them invisible is required.
Step 27: Test again. Play the game to ensure the triggers are still working
as planned.
Triggers to Swap Levels
In the last chapter we used a GUITexture as a button that when clicked invoked
the Application.LoadLevel process that exited Scene-Opening and entered
Scene-EntryWay. Triggers are another nice way of doing this. As a player walks to a
certain place in a level, Unity can exit that level and take the player to a new one.
Now, in today's games, this sort of Loading screen between levels is not as
elegant as many other games. And in fact, Unity's new Occlusion Culling
mechanisms would allow (in theory) for very large levels or even collections
of levels to all be in one scene file. Occlusion Culling simply wouldn't draw
the parts or levels that aren't seen (as opposed to the default behavior where
Unity draws everything within the camera's frustrum but just draws the things
closest to the camera last). But Occlusion Culling is a Unity Pro feature and
requires some careful construction of assets to begin with, so we're not going
to get too far into this method. Instead we'll work with the old school scheme
of having one Unity scene be the EntryWay and another be inside the base.
If you plan to expand the game, you might consider other parts of the base
as still further separate Unity scene files that are called up only when the
character moves into that part of the facility.
For the next few steps it will be important to have the inside of the base
available. These assets have been part of the Homework and Challenges of
the past tutorials, but if you have not been doing those, they are also part of a
package on the supporting web site ( http://www.Creating3dGames.com ). Be
sure to grab those and import the package into your Unity project (Hallway_
Chapter13-Start.unitypackage).
The results of the import will be a new Unity scene called Scene-Hallway.
It should already be baked, but if the baking doesn't look right, you may
need to fire the bake again. During the tech edit process we have found that
some assets when moving between operating systems sometimes lose their
lightmap connections.
 
Search WWH ::




Custom Search