Search Unity

I need a script that my camera keeps spinning automatically for 2D

Discussion in '2D' started by Pigpower6, Apr 2, 2021.

  1. Pigpower6

    Pigpower6

    Joined:
    Nov 1, 2019
    Posts:
    3
    I just need a script for my camera that keeps spinning non stop without any inputs. It looks very simple but i just cant get a salution. Its for 2D so only z.
     
  2. Vryken

    Vryken

    Joined:
    Jan 23, 2018
    Posts:
    2,106
    Code (CSharp):
    1. public class EndlessRotator : MonoBehaviour {
    2.    private void Update() {
    3.       transform.Rotate(Vector3.forward);
    4.    }
    5. }
    I'll leave it up to you to implement changing rotation speed and/or direction.