Search Unity

SOLVED: LoadScene problems using Coroutine (Awake called more than once)

Discussion in 'Editor & General Support' started by weeksy, Apr 17, 2016.

  1. weeksy

    weeksy

    Joined:
    Dec 9, 2013
    Posts:
    39
    We're using a coroutine to fade down our title UI before setting off a LoadScene for the game scene. Works fine first time round. But once we go back to title and do it again, it fails in a very strange way.

    A script will call it's Awake, then Destroy itself. Then it will magically Awake again. I have proved that this is the only script in the scene and there are no extra systems that could be causing it. This happens on multiple different scripts. I have even renamed the script between it calling Awake and OnDestroy to make sure it's not some other rogue element.

    If I stop the LoadScene from being called in a Coroutine, it works fine.

    Is this something known about? It's had me stumped for a few days now.
     
  2. pointcache

    pointcache

    Joined:
    Sep 22, 2012
    Posts:
    579
    Should it just mean you load scene twice?
     
  3. weeksy

    weeksy

    Joined:
    Dec 9, 2013
    Posts:
    39
    Scene is not loaded twice, at least not by me.
     
  4. damiondaley45

    damiondaley45

    Joined:
    Feb 6, 2019
    Posts:
    1
    I am currently experiencing the same exact problem