1
0
Files
LupiNexMedia f84f5c592b initial commit
2026-04-28 09:32:03 +02:00

22 lines
492 B
C#

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);
}
}