Search Issue Tracker
Fixed in 2022.1.X
Move Game Object To Unloaded scene on scene unloaded callback is possible, and leaves the object without valid scene
1. Open attached project.
2. Run tests.
Moving game object to scene (which was unloaded), on sceneUnloaded callback is possible. It succedes, then scene is destroyed but object is not unloaded, it stays without valid scene, floating in space. So if user looses reference to that game object, it won't be possible to destroy it.
Although, if unloaded scene does not have path (it means it come from SceneManager.CreateScene in runtime), then game object is stored in DontDestroyOnLoad scene
Expected result: I think gameObject.scene should always be valid. This operation should not be possible at all, or object should be stored in DontDestroyOnLoad.
Reproduced: 2017.2.0b3 (4c2ac554540c)
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
- Error is thrown when removing an element from a list in a ScriptableObject in the Inspector window
- GameObjects don't interact with other GameObjects when the Cloth component is applied
- CreateAsset does not persist keywords set to a material
- [2D][macOS] Rendering artifacts when dragging .PNG or .JPEG image files to the Scene view
- [Linux][URP] Sprites are flickering in scene when added into 2D URP project