Search Issue Tracker

Fixed in 5.5.0

Votes

15

Found in

5.3.1p3

Issue ID

762371

Regression

No

Unity Hangs on SceneManager.UnloadScene

Assets Management

-

Reproduction steps:

1. Open the scene "Spoke Room 00"

2. Make the cube collide with the sphere one time.

3. Make the cube collide a second time with the sphere (the trigger is launched OnTriggerEnter). The Editor hangs in this point.

Reproducible: 5.4.0b2, 5.3.1p3

Comments (4)

  1. Johannski

    Oct 05, 2016 07:29

    Also reproducible in 5.4.1f1, but the workaround mentioned by Lassade still works. So you have to wait to the end of the frame otherwise the GameObject destroy immediate calls will create problems in the physics.

    yield return new WaitForEndOfFrame();
    SceneManager.UnloadScene("MyScene");

  2. Lukas Brunner

    May 17, 2016 00:22

    I had exactly the same issue when exiting playmode. In play mode i load another scene additively which means that if a exit playmode it will be unloaded by the editor automatically (just a wild guess but I think its technically the same thing).
    The interesting thing:
    I have a canvas in my loaded scene, if I remove that canvas everything is fine again. So maybe it is due to a bug with the canvas?
    Can you guys eventually confim that?

  3. TSRajesh

    Mar 27, 2016 18:54

    I do wait some time (yield return new WaitForSeconds(1.0f) ).. But still, hangs on unloadscene.
    Works OK in Editor. But Crashes in Built exe. (Win x86).
    (One thing I noticed is.. It happens if I first change active scene.. And then unload the just-deactivated scene. Even If i yield-wait for few seconds in between)

    Currently on 5.4.3p1

  4. lassade

    Mar 25, 2016 18:32

    I found i way around this, instead os just calling UnloadScene, create a coroutine that when the trigger recives a on enter event wait for the end of frame then unload the scene.

    Like this:

    yield return new WaitForEndOfFrame();
    SceneManager.UnloadScene("MyScene");

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.