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

UI

-

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

Comments (16)

  1. 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.

  2. 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.

  3. 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.

  4. 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.

  5. browne11

    Oct 14, 2016 01:22

    Ran into this today. Glad to see a fix coming.

  6. Kenbie

    Sep 17, 2016 14:31

    Have the same problem since i added a second camera for making a minimap!

  7. 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.

  8. 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.

  9. 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

  10. JuliusJ

    Aug 18, 2016 05:13

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.