Search Issue Tracker
Fixed in 5.5.0
Votes
18
Found in
5.4.0f2
Issue ID
817145
Regression
Yes
[Editor][DirectX] Destroying/Deactivating Worldspace canvas crashes editor
Steps to reproduce:
1. Open attached project "817145repro.zip"
2. Open scene "delete" and run it
3. Press space key and Unity will crash once Destroy(canvas.gameObject) is called
Not reproducible in standalone builds
Reproduced with: 5.4.0f2, 5.4.0f3, 5.5.0a5
Not reproducible: 5.4.0f1
Unity crashes at: std::_Tree<std::_Tset_traits<TextureID,std::less<TextureID>,stl_allocator<TextureID,57,16>,0> >::_Insert
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Articulation Body with 'Revolute' Joint Type has erratic behavior when Upper Limit is set to above 360
- WebGL Player fails to render Scene when Terrain with Detail Mesh is added and WebGPU Graphics API is used
- Inconsistent errors are logged when different types are passed into the Query "Q<>" method in UIToolkit and the ancestor VisualElement is null
- Crash on GetMaterialPropertyByIndex when opening a specific Scene
- Discrepancies in the styling are present when using a TSS file instead of a USS file in custom EditorWindow
Neil-Kemojo-Martin
Mar 20, 2017 23:57
This isn't fixed in Unity 5.5.0 as I still get this in 5.5.2f1. Thanks to @as-andrew for his canvas.renderMode = RenderMode.ScreenSpaceOverlay solution as that got me experimenting to find my own solution. Setting just the renderMode did not work for me, I also had to set the worldCamera to null. Just setting the worldCamera to null didn't work alone. So the following allowed me to delete my canvas...
myCanvas.worldCamera = null;
myCanvas.renderMode = RenderMode.ScreenSpaceOverlay;
Destroy(myCanvas, 0.1f);
As the canvas I was deleting belongs to a child of a game object with a canvas of its own, performing the above will also change the same values for the parent canvas. So I had to fix the parent canvas values after the child canvas was deleted. So I added a behaviour that set my main canvas values every frame.
mainCanvas.renderMode = RenderMode.ScreenSpaceCamera;
mainCanvas.worldCamera = Camera.main;
Very hacky, but it works in my case.
InuTec
Dec 12, 2016 23:28
I have the same problem. It is the camera with the render target. If I disable the camera in the scene or delete it from the scene, everything works well.
As long as the camera is enabled the Unity editor hangs spinning in an infinite loop when destroying a gameobject.
browne11
Nov 06, 2016 17:41
It's rather unbelievable that this fix is stuck in beta still. Can you please push this to a live version of Unity. I'm getting tired of this bug. I don't understand how anyone can even design a game with the engine right now with this bug active. The only work around I have found to work is to sequentially delete any child object in the canvas then delete the canvas if it's empty. A total pain in the butt and a very slow solutions.
AS-Andrew
Oct 18, 2016 21:48
We are also running into this problem in our project. Until the fix is in a stable release, a work-around that has worked for us was to set the Canvas.renderMode to anything not World Space (ie. canvas.renderMode = RenderMode.ScreenSpaceOverlay) before destroying or disabling it.
browne11
Oct 14, 2016 01:22
Ran into this today. Glad to see a fix coming.
Kenbie
Sep 17, 2016 14:31
Have the same problem since i added a second camera for making a minimap!
LaisyLofar
Aug 25, 2016 13:18
Quick note to Anyone having this problem, we started experiencing this around the same time we'd added a new camera into our scene. Disabling this extra camera allowed us to SetActive(false) and Destroy() world space canvases again.
Also, just a note to Unity guys who may fix this, the Camera we'd added has a target render texture set.
LaisyLofar
Aug 24, 2016 12:48
Just bumped into this... We're switching necessary canvases to screen space until a fix comes out - obviously it doesn't behave as we'd intended but I'm hoping a work-around will come out ASAP so we can switch them back safely.
scott-plutovr
Aug 19, 2016 05:16
We are seeing a crash of the Unity editor (5.4.0f3 and 5.4.0p2) when a particular game object is fed into GameObject.Destroy(). The stack back trace looks like this, could it be the same issue?
d3d11!CContext::TID3D11DeviceContext_Unmap_<1>+0x4
Unity!GeometryJobTasks::EndGeometryJobFrame+0x130
Unity!GfxDeviceWorker::RunCommand+0x131d
Unity!GfxDeviceWorker::Run+0x2f
Unity!GfxDeviceWorker::RunGfxDeviceWorker+0x4d
Unity!Thread::RunThreadWrapper+0x38
kernel32!BaseThreadInitThunk+0x14
ntdll!RtlUserThreadStart+0x21
JuliusJ
Aug 18, 2016 05:13
Crash on open gl was reproduced in https://issuetracker.unity3d.com/product/unity/issues/guid/818891