Add a Plane GameObject and a Cube GameObject to the Scene panel. Add a Rigidbody Component to the Cube GameObject so it will fall to the Plane GameObject. Also add a Directional Light to the Scene panel if there isn't one already. Then we'll add a GUI button to switch to the PlayState
object. To do so, perform the following steps:
ShowIt()
method of BeginState
:
if (GUI.Button(new Rect(10, 10, 150, 100), "Press to Play"))
{
manager.SwitchState (new PlayState (manager));
}
We now have a little bit of action in the Scene. When you click on Play, the following screenshot will be shown:
Then the Cube GameObject falls to the ground, Plane, as shown in the following screenshot:
Suppose your game had many things moving around, and instead of a button, you had a fullscreen graphic. You will not see any of that movement, nor will you really want all that action taking place before you switch to the PlayState
class.
18.218.224.226