using UnityEngine; public class DayNightCycle : MonoBehaviour { [Tooltip("Duration of a full day in seconds")] public float secondsPerDay = 120f; private float rotationPerSecond; void Start() { // Calculate how many degrees the light should rotate per second rotationPerSecond = 360f / secondsPerDay; } void Update() { // Rotate around the X-axis transform.Rotate(Vector3.right, rotationPerSecond * Time.deltaTime); } }