<aside> 📄 This script will load a new scene after a set amount of time.
</aside>
using UnityEngine;
using UnityEngine.SceneManagement;
public class SceneResetTimer : MonoBehaviour
{
[Tooltip("Time in seconds before the scene resets.")]
public float resetTime = 60f;
private float timer;
void Start()
{
timer = resetTime;
}
void Update()
{
timer -= Time.deltaTime;
if (timer <= 0f)
{
ReloadScene();
}
}
public void ReloadScene()
{
SceneManager.LoadScene(SceneManager.GetActiveScene().name);
}
// Optional: Call this to manually reset the timer from other scripts
public void ResetTimer()
{
timer = resetTime;
}
}