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. 25515516823fed53d337b97ec9e9793c?d=mm

    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. 78b98245cd5870b612b1bbff74d2c5fb?d=mm

    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. F0a3bb83ad222e04dc7750bfc671816f?d=mm

    Cover-Club-Media

    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. C0e06f6f8d08eca1a216242b4e551ca8?d=mm

    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. F0a3bb83ad222e04dc7750bfc671816f?d=mm

    Cover-Club-Media

    Oct 14, 2016 01:22

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

  6. 1bb2a9c5ace75cf2f3f0bab8d49cfee4?d=mm

    Kenbie

    Sep 17, 2016 14:31

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

  7. 22a91291139424b4561cc1e806855170?d=mm

    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. 22a91291139424b4561cc1e806855170?d=mm

    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. 327798f5c73aeed759899e54486e2f4b?d=mm

    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. 3826b4d42892778f649fa8c0ce0e42b4?d=mm

    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.