SceneTemplate_RotateCube.cs 654 B

12345678910111213141516171819202122
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. // Rotates the cube in the template scene
  5. public class SceneTemplate_RotateCube : MonoBehaviour
  6. {
  7. [Tooltip("Changes the rotation speed of the cube")]
  8. public float rotateSpeed = 1f;
  9. [Tooltip("Changes orientation of the cube")]
  10. public Vector3 objectRotation;
  11. //Called every frame the app is running
  12. // Note that "*" represents multiplication
  13. void Update()
  14. {
  15. //Change the rotation (by the defined orientation * the time that has passed * defined speed)
  16. transform.Rotate(objectRotation * Time.deltaTime * rotateSpeed);
  17. }
  18. }