Time for action – changing the color using GUI buttons
Once again, we will add some code to PlayerControl
and to the ShowIt()
method of SetupState
. We will be creating five GUI buttons to change colors. While we're at it, we'll also create a GUI label to tell the user to press the Space bar to pause Player rotation, and modify the button to switch States.
- The following screenshot is of the
PlayerControl
script. Add the code shown in the red boxes: - The next screenshot is of the
ShowIt()
method ofSetupState
. Write your code as shown:
What just happened? ...
Get Learning C# by Developing Games with Unity 3D Beginner's Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.