Table of Contents
Too tired of creating a simple rotating animation for a single gameobject?
Realizing that you need to create the same rotating animation for another gameobject?
Me too, that is why I created this simple to use Auto Rotate Control script.
version 0.0.1
- Instant rotation of GameObjects.
- Add as many objects that you want to rotate together.
- Assign keys to rotate and reset the rotation.
- Adjust the speed of the rotation.
- Open Unity and add a Cube to the scene.
- Create an empty GameObject and rename it to AutoRotateControl.
- Attach the AutoRotateControl.cs script to the AutoRotateControl.
- Add the Cube or as many GameObjects that you want to rotate together in the same script by adding them to the Object To Rotate list.
- If you want to rotate the object/objects on key press, simply check the Key Press Enable and select the keys you wish to use.
- Adjust the speed by moving the Slider.
- Add Notes on top to keep track of the objects that you AutoRotate.
- Press Play in your editor and all the objects you had assigned will now rotate according to your settings.
Simply add the script to any GameObject and set the properties.
Variable | Annotation |
Notes | Add Notes |
Start Rotate Key | Set the key to press to start the rotation |
Reset Rotation Key | Set the key to press to reset the rotation |
Key Press Enable | If enable, rotation will only start on the key pressed assigned to Start Rotate Key |
Positive X | The GameObject/GameObjects will rotate in the Vector3.right direction |
Negative X | The GameObject/GameObjects will rotate in the Vector3.left direction |
Positive Y | The GameObject/GameObjects will rotate in the Vector3.up direction |
Negative Y | The GameObject/GameObjects will rotate in the Vector3.down direction |
Positive Z | The GameObject/GameObjects will rotate in the Vector3.back direction |
Negative Z | The GameObject/GameObjects will rotate in the Vector3.forward direction |
Speed | Adjust the speed of the rotation |
Object To Rotate | Arrays of object to be rotated |
version 0.0.1 (August 2022)
- Does not work for VR
- Able to add a groups of objects to be rotated. (Allow you to differentiate different group rotation)