Time for action – rotating Player in SetupState

There will be a setting in the Inspector panel to set the rotating speed. Why is Player rotating in SetupState? It allows you to view the changes made to Player. It's also a nice visual effect, much better than just looking at a static screen.

  1. Create a script containing the code shown in the following screenshot:
    Time for action – rotating Player in SetupState
  2. Create a C# Script and name it PlayerControl.
  3. Open it in MonoDevelop.
  4. Add the setupSpinSpeed variable as shown on line 6 of the preceding screenshot.
  5. Modify Update() as shown on line 13 of the preceding screenshot.
  6. Save the file.
  7. Attach this script to the Player GameObject.

To control the rotation ...

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.