Coroutine only starts when directly loading a scene from Unity editor.

Hi,

I have a character selection screen that displays a confirmation screen and when selecting, a coroutine is started, a burst of particles fly into the screen and the new level is loaded - this is to delay the loading of the level so the particles can fill the screen.

This all works as intended when I test it by directly loading the scene (character selection) on the Unity editor, however, if I’m doing a full test and I come from (Start Screen) I can do everything and the debug says it is registering everything, however the particles don’t show up and the loading doesn’t execute.

Also, the console doesn’t display any errors.

I’ve tried everything (Stop coroutine, using a while(true)…) but can’t figure out why it doesn’t load. Code below:

IEnumerator DelayLoad()
{

        heartExplosion[explosionNumber].gameObject.SetActive(true);
        yield return new WaitForSeconds(1);
        SceneManager.LoadScene(sceneName);
    
}

public void LoadEloise() {
    sceneName = "Eloise"; //selects the character and therefore which new scene will be loaded
    explosionNumber = 10; //selects the particle system that corresponds to that character
    StartCoroutine(DelayLoad());
}

The UI button has LoadEloise() as the method that gets triggered when clicking on it.

This is a video showing what happens when testing from the screen the coroutine is hosted: Unity 2018 3 12f1 02 Character Selection unity Breakup Simulator PC, Mac & Linux Standalone D - YouTube

And this is what happens when reaching the same part from the previous scene: Unity 2018 3 12f1 01 Start Screen unity Breakup Simulator PC, Mac & Linux Standalone DX11 20 - YouTube

Thanks a lot!

Managed to find the issue, it had nothing to do with that part of the code but with a line coming from a library that I was using on the previous scene and forgot about and which changed the time settings of the project.