Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Assertion failed: Transform has SetIsDispatchInterested present when destroying the hierarchy.

Discussion in 'Editor & General Support' started by moco2k, Nov 18, 2017.

  1. moco2k

    moco2k

    Joined:
    Apr 29, 2015
    Posts:
    294
    Hey everyone,

    after updating to the latest Unity patch 2017.2.0p2, I sometimes encounter the following assertion errors after closing an editor game session in play mode:

    Assertion failed: Transform has SetIsDispatchInterested present when destroying the hierarchy. Systems must deregister themselves in Deactivate.
    0x00000001411BD6CB (Unity) StackWalker::GetCurrentCallstack
    0x00000001411C005F (Unity) StackWalker::ShowCallstack
    0x000000014109A150 (Unity) GetStacktrace
    0x000000014059A493 (Unity) DebugStringToFile
    0x000000014059AC71 (Unity) DebugStringToFile
    0x00000001407C21EA (Unity) ValidateInterestedSystemsIsEmpty
    0x00000001407C757E (Unity) Transform::MainThreadCleanup
    0x0000000140255A99 (Unity) delete_object_internal_step1
    0x00000001405B7522 (Unity) CommitBatchDelete
    0x00000001405CAC85 (Unity) DestroyGameObjectHierarchy
    0x00000001405DBC3F (Unity) DestroyObjectHighLevel
    0x00000001405FA11D (Unity) DestroyWorldObjects
    0x0000000140B8B9F6 (Unity) EditorSceneManager::RestoreSceneBackups
    0x00000001410D052A (Unity) PlayerLoopController::ExitPlayMode
    0x00000001410D0BB0 (Unity) PlayerLoopController::SetIsPlaying
    0x00000001410D1A02 (Unity) Application::TickTimer
    0x00000001412DB5E9 (Unity) MainMessageLoop
    0x00000001412DCEA4 (Unity) WinMain
    0x0000000141DF75D8 (Unity) __tmainCRTStartup
    0x0000000077A959CD (kernel32) BaseThreadInitThunk
    0x0000000077CCA561 (ntdll) RtlUserThreadStart

    I think that this even leads to crashes in builds, but I'm not definitely sure about this so far.
    I've never seen this before the latest patch.

    Any help is much appreciated.

    Thanks.
     
    Last edited: Nov 18, 2017
  2. Mark-Davis

    Mark-Davis

    Joined:
    Jun 21, 2011
    Posts:
    156
  3. MinkyuPark80

    MinkyuPark80

    Joined:
    Dec 13, 2014
    Posts:
    2
    I have same issue after updating 2017.2.0p2.

    I turned on XR settings. (Oculus, Daydream)
    When I load another scene using SceneManager, the below error occur.


    Assertion failed: Transform has SetIsDispatchInterested present when destroying the hierarchy. Systems must deregister themselves in Deactivate.
    Assertion failed: Transform has SetIsHierarchyDispatchInterested present when destroying the hierarchy. Systems must deregister themselves in Deactivate.
     
    hot25369 likes this.
  4. EdBlais

    EdBlais

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    307
    Do any of you have reproducible steps without using Vuforia? I can certainly reproduce this using the Vuforia steps, but as most of you are seeing this without Vuforia present, I want to run through some known cases to make sure the same fix works across the board.
     
  5. gudouan

    gudouan

    Joined:
    Dec 2, 2017
    Posts:
    3
  6. gudouan

    gudouan

    Joined:
    Dec 2, 2017
    Posts:
    3

    I am troubled by this error as well!
    This error now appears after upgrading to "Unity 2017.2.0p3".
    So I posted it on the forum.

    https://forum.unity.com/threads/problem-with-error-when-scene-transitions.507158/

    In addition, I do not use VUFORIA.
    This error appears when make a scene transition.
     
  7. Tyrathect

    Tyrathect

    Joined:
    Jul 10, 2012
    Posts:
    38
    Same here. Not using VUFORIA. I have an object that that starts in the scene. I delete that one in the game, and spawn a new one. When I delete the spawned one, I get this error, but not when I delete the original one.
     
  8. MigrantP

    MigrantP

    Joined:
    Jun 24, 2013
    Posts:
    116
    I'm seeing the same thing in Unity 2017.2.0p4, in a similar situation to Tyrathect.
     
    valentino_rortos likes this.
  9. EdBlais

    EdBlais

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    307
    @gudouan @Tyrathect Could either of you create a project that reproduces the issue and file a bug report with the repro steps? It sounds like Tyrathect you have one that is easy for you to reproduce.
    If you can, please post the bug number on this forum and include this forum post in the bug report description.
     
  10. moco2k

    moco2k

    Joined:
    Apr 29, 2015
    Posts:
    294
    I think chances are that this assertion issue might be somehow related to a previous assertion issue. I have some rough indicators for this guess. First, the previous assertion issue has been fixed in 2017.2.0p2. With this very same version, the new issue described in this thread started to appear. Second, based on my test results, I think that both assertion issues are related to scene complexity so that a higher scene complexity increases chances that the issue appears. Also, they both seem to be somehow related to the scene hierarchy.

    So, in order to find the root cause of this assertion, maybe it is also helpful to look into the repro-cases and solution of the previous issue.
     
    Last edited: Dec 17, 2017
  11. rr_7827

    rr_7827

    Joined:
    Feb 23, 2017
    Posts:
    4
    This is happening whenever a collider is disabled on a GameObject which is not currently activeInHierarchy. Here's a simple repro:

    var obj = new GameObject();
    var collider = obj.AddComponent<BoxCollider>();

    // Disable the collider (while the object is inactive)
    obj.SetActive(false);
    collider.enabled = false;

    // Destroying the object will result in "Assertion failed" errors
    Destroy(obj);

    I filed a new bug today with an example project and a couple additional scenarios (Case 979801), but it was closed as a duplicate.

    Thank you!
     
    _creatio_ and moco2k like this.
  12. smonz3

    smonz3

    Joined:
    Jan 9, 2017
    Posts:
    18
    Can confirm that Steedy seems to have figured out the issue - this is confirmed on my project, whenever i end play mode in the editor with deactivated gameobjects with colliders on them i get a bunch of the errors. This happens in 2017.3.0f3
     
  13. TebogoWesi

    TebogoWesi

    Joined:
    Aug 12, 2014
    Posts:
    159
    I had this problem today, using 2017.3.0f3 . I was reactivating a bunch of stuff in onDisable, which caused this error. Moving my code to onEnable solved this problem. Its weird since my code worked fine in older builds.
     
  14. TebogoWesi

    TebogoWesi

    Joined:
    Aug 12, 2014
    Posts:
    159
    To be clear I was reactivating a colider, a child game object on OnDisable. . .nothing much but caused this said error.
     
  15. LaireonGames

    LaireonGames

    Joined:
    Nov 16, 2013
    Posts:
    696
    Does anyone know the issue tracker number for this or an ETA for when it could be in a beta build?

    Edit: oops it was at the top!
     
  16. andyz

    andyz

    Joined:
    Jan 5, 2010
    Posts:
    2,153
    Was about to report same issue (2017.3.0f3).
    Seems like a lot of assertions and errors appeared in 2017.3 or 2017.x which should never appear.
    Earlier versions of Unity were much cleaner is this sense and quietly dealt with issues if there even were any
     
  17. tomerpeledNG

    tomerpeledNG

    Joined:
    Jul 14, 2017
    Posts:
    81
    We also encounter with this...
     
  18. mhofer

    mhofer

    Joined:
    Aug 30, 2017
    Posts:
    18
    happens here as well.
     
  19. davharr

    davharr

    Joined:
    Feb 5, 2014
    Posts:
    3
    i get issue as well and i am getting it from my bullet pooling system.
    i get the error when i use gameObject.SetActive(false); on a Instantiate gameobject at runtime
    which my gameobject has 4 components a rigidbody, trail render,box collider, and a cs script

    The way i got rid of the errors was not to call gameObject.SetActive(false);
    the work around as of right not just store my bullet in a dark corner lol
     
  20. misher

    misher

    Joined:
    Apr 22, 2016
    Posts:
    19
    Workaround for those who are using Vuforia.
    Do not use default traking script. Default script iterate all colliders, mesh renderes and canvases to enable/siable them, while it is good for performance reasons (in case you have many game objects) it couse our errors. Change script (or better make new one, that just disable/enable game objects and not components. Ideally, make reference to all augmentation objects and make them enable/disable on tracking find and lost events.
     
  21. tomerpeledNG

    tomerpeledNG

    Joined:
    Jul 14, 2017
    Posts:
    81
    Is it going to fixed in the upcoming patch?
    Any workaround?
     
  22. andyz

    andyz

    Joined:
    Jan 5, 2010
    Posts:
    2,153
    I get without Vuforia on a large VR project which includes NGUI. Do not have simple repro. but as soon as stop playing the errors appear. 2017.3.0f3
    Code (csharp):
    1.  
    2. Transform has SetIsDispatchInterested present when destroying the hierarchy. Systems must deregister themselves in Deactivate.
    3. (Filename: C:\buildslave\unity\build\Runtime/Transform/Transform.cpp Line: 1658)
    4.  
    5. Transform has SetIsHierarchyDispatchInterested present when destroying the hierarchy. Systems must deregister themselves in Deactivate.
    6. (Filename: C:\buildslave\unity\build\Runtime/Transform/Transform.cpp Line: 1659)
    7.  
    Obviously a change in transform.cpp is the culprit.
    Assertions are generally turned off for production software so how come they are appearing in Unity 2017?
     
    Last edited: Feb 5, 2018
  23. _creatio_

    _creatio_

    Joined:
    Mar 21, 2013
    Posts:
    43
    We have recently began receiving this errors. Project is also pretty big (3D, no VR, no AR) with NGUI.
     
  24. Deleted User

    Deleted User

    Guest

    For me it started to appear today and was also related to colliders being disabled. Since the script had ExecuteInEditMode enabled, Awake was called on dragging the gameobject into the hierarchy throwing the errors right away. Deleting it again throws the same errors again. The same does not apply for lets say a cube with a collider. A reduced script to just disabling the collider on Awake with ExecuteInEditMode does not throw this error.
     
  25. Elliott-Mitchell

    Elliott-Mitchell

    Joined:
    Oct 8, 2015
    Posts:
    86
    I get the error too in all versions of 2017.3. (Currently testing in 2017.3.0p4).
     
    Last edited: Feb 11, 2018
  26. Elliott-Mitchell

    Elliott-Mitchell

    Joined:
    Oct 8, 2015
    Posts:
    86
    To piggy back on my last comment:
    * Only in a 2017.3X builds do I get crashes.
    * Only in the 2017.3X Editor, do I get the Assertion failed: Transform has SetIsDispatchInterested present when destroying the hierarchy. Systems must deregister themselves in Deactivate. error.

    Screenshots of XCode and the editor error from 2017.3.0p4.
    Waggle_Crash_Unity2017Dot3P4.png

    FWIW, this crash happens even when no optimizations are enabled; they are disabled in Unity Player Settings and in XCode.

    Seems like I'll have to take a pass on 2017.3 until bug is fixed. If it's fixed in a patch, and I still get the crash, then it's on to the next round of troubleshooting.

    Thanks,
    Elliott
     
    Last edited: Feb 11, 2018
  27. Lootheo

    Lootheo

    Joined:
    Mar 19, 2013
    Posts:
    4
    Elliott-Mitchell likes this.
  28. Elliott-Mitchell

    Elliott-Mitchell

    Joined:
    Oct 8, 2015
    Posts:
    86
    Lootheo likes this.
  29. tomerpeledNG

    tomerpeledNG

    Joined:
    Jul 14, 2017
    Posts:
    81
    The StopAllCoroutines didn't work for me :(
     
  30. Elliott-Mitchell

    Elliott-Mitchell

    Joined:
    Oct 8, 2015
    Posts:
    86
    There was something in there about

    transform.Find("someobject").gameObject.SetActive(false);

    FWIW, I still get crash bugs in 2017.3x on iOS builds. I can't figure it out for the life of me. My gut tells me it's related to this.
     
  31. Lootheo

    Lootheo

    Joined:
    Mar 19, 2013
    Posts:
    4
    I'm deploying for iOS too, reading the message clearer I think you might want to check for:
    Scene changes or really anything (Like it was your previous case with exiting the editor) that causes the whole hierarchy to go down, and make sure you are not trying to access it via an after-event (Like with the coroutines).
     
    Elliott-Mitchell likes this.
  32. Elliott-Mitchell

    Elliott-Mitchell

    Joined:
    Oct 8, 2015
    Posts:
    86
    It doesn't happen in 2017.2, but yes, I'm going through and checking all the coroutines. There may be a stray coroutine in a 3rd party asset or something? I may give up on this for a while and just work in 2017.2x; I have a lot of work to do over the next month and don't have time to keep troubleshooting this issue. After GDC and PAX East, I'll try again if I fail to fix this by tomorrow.

    Thanks!
     
  33. BCook99

    BCook99

    Joined:
    Feb 17, 2015
    Posts:
    11
    I found and fixed everything in Visual Studio by finding all references to the colllider.enabled field to see everywhere it was being set. Then I replaced every assignment with this function which tracked it down. This made it easy to check and stop disabling inactive colliders, and now I've got no more errors!

    Code (CSharp):
    1.     // instead of this
    2.     collider.enabled = false;
    3.  
    4.     // use this
    5.     Helpers.EnableCollider(collider, false);
    6.  
    7. internal static class Helpers
    8. {
    9.         internal static void EnableCollider(Collider collider, bool enable)
    10.         {
    11.             if (!collider)
    12.                 return;
    13.  
    14.             // Unity bug: https://forum.unity.com/threads/assertion-failed-transform-has-setisdispatchinterested-present-when-destroying-the-hierarchy.505111/
    15.             if (!collider.gameObject.activeInHierarchy && !enable && collider.enabled)
    16.                 Debug.LogWarning("Disabling inactive collider: " + GetHierarchyPath(collider.transform), collider);
    17.             collider.enabled = enable;
    18.         }
    19.  
    20.         internal static string GetHierarchyPath(Transform transform)
    21.         {
    22.             if (!transform)
    23.                 return string.Empty;
    24.  
    25.             string path = transform.name;
    26.             while (transform.parent != null)
    27.             {
    28.                 transform = transform.parent;
    29.                 path = transform.name + "/" + path;
    30.             }
    31.             return path;
    32.         }
    33. }
     
  34. Elliott-Mitchell

    Elliott-Mitchell

    Joined:
    Oct 8, 2015
    Posts:
    86
    Oh, this looks promising! I'll check it out. thanks!
     
  35. EdBlais

    EdBlais

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    307
    Hey everyone, sorry this issue is still present. We pushed a bugfix in 2017.3.0p2, but it looks like it didn't resolve every edge case. I've messaged the developer who made to change to help track down the remaining issue.
     
    andyz likes this.
  36. Elliott-Mitchell

    Elliott-Mitchell

    Joined:
    Oct 8, 2015
    Posts:
    86
    Thanks! I either resolved my issue via code or the Unity 2017.3.1p1 update :p
     
  37. Jack-Unity

    Jack-Unity

    Unity Technologies

    Joined:
    May 21, 2013
    Posts:
    34
    Hi, we caught another instance of this occurring and this is now fixed in 2017.3.1p3 which has just been released. If anyone is able to verify it fixes their issue that would be very helpful and of course if you are still getting the error then report back here and we can take another look but I really think we got it this time ;)
     
    Elliott-Mitchell likes this.
  38. MSachs

    MSachs

    Joined:
    Nov 22, 2017
    Posts:
    117
    Have the same issue. How do I get the 2017.3.1p3 version? in Unity it says I have the newest version (2017.3.0f3)
     
  39. Jack-Unity

    Jack-Unity

    Unity Technologies

    Joined:
    May 21, 2013
    Posts:
    34
  40. MSachs

    MSachs

    Joined:
    Nov 22, 2017
    Posts:
    117
    Thanks a lot! Completely resolved the issue for me :)
     
  41. Jack-Unity

    Jack-Unity

    Unity Technologies

    Joined:
    May 21, 2013
    Posts:
    34
    Great news. Thanks for confirming.

    Anyone else who is still seeing this after updating to 2017.3.1p3 please let us know.
     
  42. Deleted User

    Deleted User

    Guest

    I can also confirm that it's gone for me too.
     
    MSachs likes this.
  43. GetBrinxed

    GetBrinxed

    Joined:
    Feb 21, 2018
    Posts:
    12
    Any idea when (and if) this fix will be in the next 2018.1.0bx release?
     
  44. Jack-Unity

    Jack-Unity

    Unity Technologies

    Joined:
    May 21, 2013
    Posts:
    34
    Hi this should have been out in b9. If you are still seeing the issue then please report back. And again, even better, report back that(if) it's fixed as well.
     
  45. _creatio_

    _creatio_

    Joined:
    Mar 21, 2013
    Posts:
    43
    Seems like the issue is gone for us with 2017.3.1.f1
     
  46. moco2k

    moco2k

    Joined:
    Apr 29, 2015
    Posts:
    294
    Fixed for me with 2017.3.1p3. Good work.
     
  47. Khena_B

    Khena_B

    Joined:
    Aug 21, 2014
    Posts:
    273
    Upgraded to 2017.4.0f1 and i'm getting this as well:

    Assertion failed: Transform has SetIsDispatchInterested present when destroying the hierarchy. Systems must deregister themselves in Deactivate.
    Assertion failed: Transform has SetIsHierarchyDispatchInterested present when destroying the hierarchy. Systems must deregister themselves in Deactivate.

    It seems to be happening on scene change about 50% of the time, had this error in 2017.3 as well but not in 2017.1 and previous versions.
     
    Last edited: Mar 26, 2018
  48. GetBrinxed

    GetBrinxed

    Joined:
    Feb 21, 2018
    Posts:
    12
    Yep, fixed. Thank you!
     
  49. VoxStudio

    VoxStudio

    Joined:
    Jan 12, 2016
    Posts:
    16
    Upgraded to 2017.3.1f1 and the issue is still happening for us. It happens most in change scenes and after leave the play mode.
     
  50. moco2k

    moco2k

    Joined:
    Apr 29, 2015
    Posts:
    294
    You need to install the latest patch, at least p3.