Search Unity

SceneManager.LoadScene Crash in 5.4.1

Discussion in 'Editor & General Support' started by Sake906, Sep 27, 2016.

  1. Sake906

    Sake906

    Joined:
    Mar 27, 2014
    Posts:
    45
    Not sure if this has been addressed, but I lost an entire day yesterday trying to figure out what's going on and searched far and wide on the internet about this issue to no avail.

    I am upgrading from 5.3.4f1, where my project has one or two scenes that switch with one another during game, one of them being a terrain that's heavily decorated with rocks (I'd say among the thousands, I know I should optimize) and trees.

    5.3.4f1 would switch just fine between them; calling "SceneManager.LoadScene("Name") as additive and waiting for activation would work all the time. As soon as I upgraded to 5.4.1 (and earlier this summer to a previous version of 5.4.x) the editor crashes entirely when it reaches that chunk of code and brings up an error report window, and worst: sometimes it does not crash at all and does what it should.

    I thought it was due to a thread race condition and thus moved the LoadScene code to a part of the script execution loop that I believed would not generate any thread race conditions (such as a FixedUpdate on a script forced to run last on the priority list) but it still happens.

    I believe there is a problem related to de-activation of scripts when switching to a different scene, since the same crash happens when I hide very large hierarchies of game objects: for instance, my scenes have every game object parented to a master game object that can be hidden on specific situations: trying so in 5.4.1 will crash the editor.

    I need to keep this way of working as I need to switch from a scene to the other quickly for cinematic culling reasons, so please don't start suggesting "why don't you do it thiiss other waayyyy...."; I'm bringing up something that worked perfectly fine in 5.3.4f1 and is now broken entirely in 5.4.1.

    I'm not really reporting this as an issue yet, as maybe I am missing how scenes are switched and disabled on newer versions; I'd like to discuss that here.
     
  2. SteenLund

    SteenLund

    Unity Technologies

    Joined:
    Jan 20, 2011
    Posts:
    639
    Could you please file a bug report with a project and steps to reproduce.
     
  3. Sake906

    Sake906

    Joined:
    Mar 27, 2014
    Posts:
    45
    Will take me a while to package a project with the isolated issue, but for the sake of having this solved I guess I should invest another day on this just to file the report.
     
  4. SavedByZero

    SavedByZero

    Joined:
    May 23, 2013
    Posts:
    124
    I'm having the same issue, though it still happens when I switch back to Application.loadLevel. It's not even in a loop or anything, and I've commented out every possible other line at that point during the execution, though it's possible the computer I'm using it on makes a difference in whether or not it happens. Are there some unwritten rules about where you can or can't (or shouldn't) try to load new scenes?
     
  5. Sake906

    Sake906

    Joined:
    Mar 27, 2014
    Posts:
    45
    The best you can do is send these guys a crash report. I am right now dealing with a similar issue that only happens in the stand-alone player; the game crashes when it tries to delete some objects, specially those having disabled colliders after a scene has changed multiple times. If this stuff keeps happening, I will just switch back to 5.3.1 and screw this madness, it's only making me waste time.
     
  6. SteenLund

    SteenLund

    Unity Technologies

    Joined:
    Jan 20, 2011
    Posts:
    639
    @Sake906
    Did you file the bug report? If so please post the number here, then I can take a look.
     
  7. Sake906

    Sake906

    Joined:
    Mar 27, 2014
    Posts:
    45
    The number is 853512, I believe. Just submitted a brand new one using the latest engine version.
     
  8. SteenLund

    SteenLund

    Unity Technologies

    Joined:
    Jan 20, 2011
    Posts:
    639
    @Sake906
    Seems like QA already verified that it has been fixed in 5.5, if you have access to try the beta you should