Game Development Reference
In-Depth Information
Now you can click the Build button, choose the name and location for saving the standalone version
of the game, then click Save for Unity to build the game. The resultant game files depend on the
build target. On a Mac you will get an app bundle, and for Windows you'll get a folder of resources
along with the .exe file. You can go ahead and play it yourself, or distribute these files to share your
game. Go ahead and give your new standalone a whirl.
The first thing you will see is a black screen with Unity logo (Figure 12-17 ). While all games will have
this as the default introductory screen, only Pro users can change it.
Figure 12-17. The Unity logo appears first as the standalone game is loading
Changing Scenes
Even the simplest of games have a splash screen, so you need to know how to switch from one
scene to another with the Application.LoadLevel() function.
Back in the Unity Editor, save the Obstacle Course scene and save the project. Then select
File ➤ New Scene from the top menu to create a new scene. Again in the top menu,
select GameObject ➤ Create Empty, then name it GUI.
In the Project panel Assets ➤ Scripts folder, create a new script named SplashGUI, open it in
MonoDevelop, and edit the code to the following:
#pragma strict
function OnGUI() {
GUI.Label(Rect(0, 0, 125, 25), "Splash screen");
if (GUI.Button (Rect (Screen.width/2 - 50, Screen.height/2 - 15, 100, 30), "Start")) {
Application.LoadLevel(1);
}
}
 
Search WWH ::




Custom Search