Search Unity

Resolved world.Dispose destroys Gameobjects MainScene

Discussion in 'Entity Component System' started by jdtec, Apr 9, 2021.

  1. jdtec

    jdtec

    Joined:
    Oct 25, 2017
    Posts:
    302
    It appears that the first Entities world that is created associates itself with the Unity MainScene, and when Dispose() is called on this world the MainScene is destroyed.

    This didn't previously happen. Is this expected behaviour?

    I can stop this by commenting out the following lines in com.Unity.Entities@0.17.0-preview.41/Unity.Scenes/GameObjectSceneManager.cs

    154: if(unityScene.IsValid())
    155: SceneManager.UnloadSceneAsync(unityScene);


    (Case 1327908)
     
    Last edited: Apr 9, 2021
  2. TheOtherMonarch

    TheOtherMonarch

    Joined:
    Jul 28, 2012
    Posts:
    866
    When working with multworlds adding the define UNITY_DISABLE_AUTOMATIC_SYSTEM_BOOTSTRAP will give you the behavior you want.
     
    jdtec likes this.
  3. jdtec

    jdtec

    Joined:
    Oct 25, 2017
    Posts:
    302
    Thanks! I must have removed this define myself at some point... Adding it back in has resolved my problem.