<aside> 📄 This script will load a new scene after a set amount of time.

</aside>

using UnityEngine;
using UnityEngine.SceneManagement;

public class SceneSwitch : MonoBehaviour
{
    public string nextSceneName; // Name of the scene to switch to
    public float switchDelay = 5.0f; // Duration before switching in seconds

    private float timer = 0.0f;

    void Update()
    {
        // Increment the timer each frame
        timer += Time.deltaTime;

        // Check if the timer has reached the specified delay
        if (timer >= switchDelay)
        {
            // Call a method to switch to the next scene
            SwitchScene();
        }
    }

    void SwitchScene()
    {
        // Check if the next scene name is not empty
        if (!string.IsNullOrEmpty(nextSceneName))
        {
            // Load the next scene
            SceneManager.LoadScene(nextSceneName);
        }
        else
        {
            // If nextSceneName is not set, print an error message
            Debug.LogError("Next Scene Name is not set in the SceneSwitcher script.");
        }
    }
}