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.
- Create a script containing the code shown in the following screenshot:
- Create a C# Script and name it
PlayerControl
. - Open it in MonoDevelop.
- Add the
setupSpinSpeed
variable as shown on line 6 of the preceding screenshot. - Modify
Update()
as shown on line 13 of the preceding screenshot. - Save the file.
- 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.