Scene drawing breaks when a scenes are unloaded
See original GitHub issueSummary:
Drawing of the scene handles, texts, etc. breaks when a scene was added to the hierarchy additively and is then unloaded.
Steps to reproduce:
1. Create a new scene, add a LDtk asset to it.
2. Create a second scene, add it to the hierarchy additively.
(e.g. by dragging it under the current scene) The drawing still works.
3. Unload the second scene.
(right click -> unload scene) Drawing breaks, exceptions are logged to the console.
Stuff that might help:
Exception that is logged to the console:
ArgumentException: The scene is not loaded.
UnityEngine.SceneManagement.Scene.GetRootGameObjects (System.Collections.Generic.List`1[T] rootGameObjects) (at <ef667cdc82bf4a4e911d1ddea9ff581d>:0)
UnityEngine.SceneManagement.Scene.GetRootGameObjects () (at <ef667cdc82bf4a4e911d1ddea9ff581d>:0)
LDtkUnity.Editor.LDtkFindInScenes.FindInScene[T] (UnityEngine.SceneManagement.Scene scene) (at Library/PackageCache/com.cammin.ldtkunity@2.1.2/Editor/CustomEditor/SceneDrawer/LDtkFindInScenes.cs:37)
LDtkUnity.Editor.LDtkFindInScenes.FindInAllScenes[T] () (at Library/PackageCache/com.cammin.ldtkunity@2.1.2/Editor/CustomEditor/SceneDrawer/LDtkFindInScenes.cs:24)
LDtkUnity.Editor.LDtkSceneDrawer.DrawEntityDrawers () (at Library/PackageCache/com.cammin.ldtkunity@2.1.2/Editor/CustomEditor/SceneDrawer/LDtkSceneDrawer.cs:44)
LDtkUnity.Editor.LDtkSceneDrawer.CustomOnSceneGUI (UnityEditor.SceneView view) (at Library/PackageCache/com.cammin.ldtkunity@2.1.2/Editor/CustomEditor/SceneDrawer/LDtkSceneDrawer.cs:19)
UnityEditor.SceneView.CallOnSceneGUI () (at <015079d9a4ea4f97b4381e694d2310c1>:0)
UnityEditor.SceneView.HandleSelectionAndOnSceneGUI () (at <015079d9a4ea4f97b4381e694d2310c1>:0)
UnityEditor.SceneView.OnGUI () (at <015079d9a4ea4f97b4381e694d2310c1>:0)
UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition, UnityEngine.Rect viewRect) (at <015079d9a4ea4f97b4381e694d2310c1>:0)
UnityEditor.DockArea.DrawView (UnityEngine.Rect viewRect, UnityEngine.Rect dockAreaRect) (at <015079d9a4ea4f97b4381e694d2310c1>:0)
UnityEditor.DockArea.OldOnGUI () (at <015079d9a4ea4f97b4381e694d2310c1>:0)
UnityEngine.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 parentTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout, UnityEngine.Rect layoutSize, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <1fd6bc3af931450b977286a218b046fb>:0)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <1fd6bc3af931450b977286a218b046fb>:0)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <1fd6bc3af931450b977286a218b046fb>:0)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Boolean canAffectFocus) (at <1fd6bc3af931450b977286a218b046fb>:0)
UnityEngine.UIElements.IMGUIContainer.SendEventToIMGUIRaw (UnityEngine.UIElements.EventBase evt, System.Boolean canAffectFocus, System.Boolean verifyBounds) (at <1fd6bc3af931450b977286a218b046fb>:0)
UnityEngine.UIElements.IMGUIContainer.SendEventToIMGUI (UnityEngine.UIElements.EventBase evt, System.Boolean canAffectFocus, System.Boolean verifyBounds) (at <1fd6bc3af931450b977286a218b046fb>:0)
UnityEngine.UIElements.EventDispatchUtilities.PropagateToIMGUIContainer (UnityEngine.UIElements.VisualElement root, UnityEngine.UIElements.EventBase evt) (at <1fd6bc3af931450b977286a218b046fb>:0)
UnityEngine.UIElements.EventDispatchUtilities.PropagateToIMGUIContainer (UnityEngine.UIElements.VisualElement root, UnityEngine.UIElements.EventBase evt) (at <1fd6bc3af931450b977286a218b046fb>:0)
UnityEngine.UIElements.MouseEventDispatchingStrategy.SendEventToIMGUIContainer (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel) (at <1fd6bc3af931450b977286a218b046fb>:0)
UnityEngine.UIElements.MouseEventDispatchingStrategy.SendEventToTarget (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel) (at <1fd6bc3af931450b977286a218b046fb>:0)
UnityEngine.UIElements.MouseEventDispatchingStrategy.DispatchEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel iPanel) (at <1fd6bc3af931450b977286a218b046fb>:0)
UnityEngine.UIElements.EventDispatcher.ApplyDispatchingStrategies (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, System.Boolean imguiEventIsInitiallyUsed) (at <1fd6bc3af931450b977286a218b046fb>:0)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <1fd6bc3af931450b977286a218b046fb>:0)
UnityEngine.UIElements.EventDispatcher.Dispatch (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, UnityEngine.UIElements.DispatchMode dispatchMode) (at <1fd6bc3af931450b977286a218b046fb>:0)
UnityEngine.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.UIElements.EventBase e, UnityEngine.UIElements.DispatchMode dispatchMode) (at <1fd6bc3af931450b977286a218b046fb>:0)
UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at <1fd6bc3af931450b977286a218b046fb>:0)
UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& eventHandled) (at <1fd6bc3af931450b977286a218b046fb>:0)
UnityEngine.UIElements.UIEventRegistration.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at <1fd6bc3af931450b977286a218b046fb>:0)
UnityEngine.UIElements.UIEventRegistration+<>c.<.cctor>b__1_2 (System.Int32 i, System.IntPtr ptr) (at <1fd6bc3af931450b977286a218b046fb>:0)
UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& result) (at <6ddf8eac3856492ab1b8cf42618915cc>:0)
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Object loses Inspector objects When Scene Changes
Scenes are a tool for loading and unloading resources. Why would you unload them in your case? The only reason you want scenes...
Read more >Unity - Memory not decreasing after changing scenes
The current loading process is start in 1 level, use a singleton loading screen to load into an empty scene then call System.GC.Collect();...
Read more >Breaking Scenes Down
First, I split apart the individual actions of the scene. I then group those actions into pages. Finally, I use those now divided...
Read more >Storyboard Pro 4.2 Online Help: Scenes and Panels
Select Storyboard > Split Current Scene. The scene is split into two scenes. To break the current scene: In the Preferences dialox box,...
Read more >Manual: Scene Reloading
Instead of reloading the Scene from disk, Unity only resets the Scene's modified contents. This avoids the time and performance impact of unloading...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The 2.1.4 update is now up which has a few bug fixes and better text contrast behind certain colours 👍 Feel free to post more issues if you have any 🙂
I got this fixed, it will be coming in 2.1.4 which should be coming soon-ish. Again thanks for the repro steps. I actually didn’t know that a scene could be manually unloaded in the editor instead of removing them. (Learned something new today!) I’ll follow up here and close the issue once the update is out 🙂