using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class Compass : MonoBehaviour { private float ZRotation = 0f; public float InitialRotationAngle = 0f; void Update() { if (Camera.main) { ZRotation = Camera.main.transform.eulerAngles.y + InitialRotationAngle; this.transform.eulerAngles = new Vector3(0, 0, ZRotation); } } }