Load Scene with Coroutine

Hello,

I have a piece of code that loads a scene and then after 4 seconds loads another. But somehow it doesn’t load the second scene.

I am kinda learning unity so it may be a little mistake but i cant figure it out.

Any help is appreciated

public void StartGame()
    {
        SceneManager.LoadScene("LoadingScreen");

        Debug.Log("Loading in 4 seconds");

        StartCoroutine(StartDelay());
    }

    IEnumerator StartDelay ()
    {
        Debug.Log("Coroutine Loaded");

        yield return new WaitForSeconds(4f);

        Debug.Log("Loaded");

        SceneManager.LoadScene("Level01");
        FindObjectOfType<AudioManager>().Play("Ambiente");
        Health.ResetLife();
       
    }

Because your game object is destroyed when loading another scene. This Unity - Scripting API: Object.DontDestroyOnLoad may help

oh i see,

thank you