Hey all!
Im trying to reload the scene that the player is in with this code in systembase:
World.DisposeAllWorlds();
DefaultWorldInitialization.Initialize("Test World", false);
SceneManager.LoadScene("World", LoadSceneMode.Single);
and im getting these errors:
InvalidOperationException: object is not initialized or has already been destroyed
Unity.Entities.ComponentSystemBase.CheckedState () (at Library/PackageCache/com.unity.entities@0.13.0-preview.24/Unity.Entities/ComponentSystemBase.cs:333)
Unity.Entities.ComponentSystemBase.AfterUpdateVersioning () (at Library/PackageCache/com.unity.entities@0.13.0-preview.24/Unity.Entities/ComponentSystemBase.cs:614)
Unity.Entities.ComponentSystem.AfterOnUpdate () (at Library/PackageCache/com.unity.entities@0.13.0-preview.24/Unity.Entities/ComponentSystem.cs:63)
Unity.Entities.ComponentSystem.Update () (at Library/PackageCache/com.unity.entities@0.13.0-preview.24/Unity.Entities/ComponentSystem.cs:116)
Unity.Entities.ScriptBehaviourUpdateOrder+DummyDelegateWrapper.TriggerUpdate () (at Library/PackageCache/com.unity.entities@0.13.0-preview.24/Unity.Entities/ScriptBehaviourUpdateOrder.cs:322)
and
NullReferenceException: Object reference not set to an instance of an object
Unity.Entities.Editor.ComponentSystemBaseNode`2[TSystem,TNode].get_NameWithWorld () (at Library/PackageCache/com.unity.dots.editor@0.9.0-preview.1/Editor/SystemSchedule/PlayerLoop/ComponentSystemNodes.cs:15)
Unity.Entities.Editor.ComponentSystemBaseNode`2[TSystem,TNode].get_Hash () (at Library/PackageCache/com.unity.dots.editor@0.9.0-preview.1/Editor/SystemSchedule/PlayerLoop/ComponentSystemNodes.cs:30)
Unity.Entities.Editor.PlayerLoopSystemGraph.DidChange (Unity.Entities.Editor.IPlayerLoopNode lhs, Unity.Entities.Editor.IPlayerLoopNode rhs) (at Library/PackageCache/com.unity.dots.editor@0.9.0-preview.1/Editor/SystemSchedule/PlayerLoop/PlayerLoopSystemGraph.cs:70)
Unity.Entities.Editor.PlayerLoopSystemGraph.DidChange (Unity.Entities.Editor.IPlayerLoopNode lhs, Unity.Entities.Editor.IPlayerLoopNode rhs) (at Library/PackageCache/com.unity.dots.editor@0.9.0-preview.1/Editor/SystemSchedule/PlayerLoop/PlayerLoopSystemGraph.cs:75)
Unity.Entities.Editor.PlayerLoopSystemGraph.DidChange (Unity.Entities.Editor.PlayerLoopSystemGraph lhs, Unity.Entities.Editor.PlayerLoopSystemGraph rhs) (at Library/PackageCache/com.unity.dots.editor@0.9.0-preview.1/Editor/SystemSchedule/PlayerLoop/PlayerLoopSystemGraph.cs:55)
Unity.Entities.Editor.PlayerLoopSystemGraph.ValidateCurrentGraph () (at Library/PackageCache/com.unity.dots.editor@0.9.0-preview.1/Editor/SystemSchedule/PlayerLoop/PlayerLoopSystemGraph.cs:37)
UnityEditor.EditorApplication.Internal_CallUpdateFunctions () (at <b17f35b08b864a3ca09a7032b437596e>:0)
Qeustion:
What is the correct way to reload the scene without the entities that are created in runtime?