O'Reilly logo

Learning C# by Developing Games with Unity 3D Beginner's Guide by Terry Norton

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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.

  1. The following screenshot is of the PlayerControl script. Add the code shown in the red boxes:
    Time for action – changing the color using GUI buttons
  2. The next screenshot is of the ShowIt() method of SetupState. Write your code as shown:
    Time for action – changing the color using GUI buttons

What just happened? ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required