Search Unity

Hard crash when enabling/disabling UI elements

Discussion in 'Editor & General Support' started by Menion-Leah, Jan 9, 2018.

  1. Menion-Leah

    Menion-Leah

    Joined:
    Nov 5, 2014
    Posts:
    95
    It happens a lot in Unity 2017.2 and 2017.3.0p1.
    I wasted weeks trying to get rid of this random crashes, both in editor and Android builds.

    Basically, if you quickly click over UI elements that activate/deactivate others, or when you quit the game, you get an hard crash, both in editor and Android builds, with vague (or zero) information logged.

    A typical stack trace shows this (Android):
    or this (Editor):

    This kind of bug has been reported here, one year and half ago: https://issuetracker.unity3d.com/issues/disabling-ui-crashes-at-gameobject-isactive

    I also noticed an identical behavior related to activating an object with an Animator component.
    (another example with GameObject.SetActive and Animator can be found here: https://answers.unity.com/questions/825223/editor-crash-log-help-diagnosing.html)

    Other reports:
    https://forum.unity.com/threads/segv_maperr-in-android-build.436720/
    https://groups.google.com/a/candlelightinteractive.com/forum/#!topic/developer-support/vOfbV6Uj1EA
    https://issuetracker.unity3d.com/is...s-as-child-crashes-in-ui-canvas-getrendermode

    Logs also often point out some Access violation reading location problem.

    Anyone else facing this issue?

    Please, fix it ASAP, it's impossible to ship a game that randomly crashes when user click on the UI.
     
    Last edited: Jan 9, 2018
    hadesfury likes this.
  2. Menion-Leah

    Menion-Leah

    Joined:
    Nov 5, 2014
    Posts:
    95
    Double checked: in Unity 2017.1.3f1 there's no crash, neither in builds or editor.

    Also it's worth mentioning I discovered that in some cases it's the Perf Reporting itself that causes android builds to crash, as pointed out here: https://fogbugz.unity3d.com/default.asp?987035_k69cphrctmio8dih

    This is driving me nuts, I totally changed every single component that ever caused a crash, with no luck. They simply keep on happening, randomly.
     
  3. anudeepb23

    anudeepb23

    Joined:
    Feb 2, 2018
    Posts:
    2
    Open your mobile device and move to settings.
    Then move to Application Manger.
    Now look in the upper right of the screen and click on three dots ,here you must select " Reset app preferences".
    Now,
    atlast restart your mobile device and after reboot the crashes or the error should be gone once and for all.
     
  4. Menion-Leah

    Menion-Leah

    Joined:
    Nov 5, 2014
    Posts:
    95
    Seems quite unlikely to work. Fresh installations have the same issue too.

    Assuming that workaround works, it would still be totally unacceptable in production.

    It also crashes the Unity editor.. so no, I don't think this could be a viable solution.
     
  5. GDBMain

    GDBMain

    Joined:
    Oct 17, 2016
    Posts:
    2
  6. anudeepb23

    anudeepb23

    Joined:
    Feb 2, 2018
    Posts:
    2
    build some versions of builds and comparing the builds,

    try to use open-source library code,at the same time you have to balance this by taking the open source library code selectively and not as you like,i.e., the code that suits your application better
     
  7. aaron921

    aaron921

    Joined:
    Mar 10, 2018
    Posts:
    1
    yes ,

    build some versions of builds and comparing the builds,
     
  8. hadesfury

    hadesfury

    Joined:
    Jan 23, 2014
    Posts:
    23
  9. Ubiant

    Ubiant

    Joined:
    Oct 17, 2017
    Posts:
    6
  10. Menion-Leah

    Menion-Leah

    Joined:
    Nov 5, 2014
    Posts:
    95
  11. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    1,828
  12. Menion-Leah

    Menion-Leah

    Joined:
    Nov 5, 2014
    Posts:
    95
  13. Ubiant

    Ubiant

    Joined:
    Oct 17, 2017
    Posts:
    6
    @LeonhardP have you any release notes to point this ?
    Cause currently in 2018.X release notes, I found nothing that explain this fix. That could be great to add it or at least point the line here please ?

    @Menion-Leah : superpig is a well known unity dev, you can trust his word. So now, I'm thinking which version between Superpig and Leonhard one will be the good one !

    Sorry this bug has been so many times indicates as "fix" that now I'm doubting about it :p
     
    Menion-Leah likes this.
  14. Menion-Leah

    Menion-Leah

    Joined:
    Nov 5, 2014
    Posts:
    95
    Sure, no lack of trust here! I was just wondering, because it seemed that Twitter OP was stating it as solved on the 14th of March, and then having issues again just a few hours ago.
     
    NinjaPigStudios likes this.
  15. Ubiant

    Ubiant

    Joined:
    Oct 17, 2017
    Posts:
    6
    yeah but "Fixed in 2018.2" which will be the 2018 summer release (so in June / July). That's why I doubt to see that fix in the 2018.1 release in April.
    By the way, I didn't find the issue tracker bug id in the release note even in the 2018.1b13
     
    Menion-Leah likes this.
  16. Ubiant

    Ubiant

    Joined:
    Oct 17, 2017
    Posts:
    6
    @superpig when you asked me if we used pool for the object during the crash. (cf : twitter link above)
    My initial answer was no cause our pool system doesn't setActive UI element but disabled them cause it was more effective than other method.

    But some of our menu follow that kind of logic (which is not a pool manager behind but quite the same than a pool logic) :
    - Activate side menu by a SetActive(true)
    - Animated it
    - Menu is now displayed in our game
    - Click on a button in it
    - Animated it back to hide it
    - Then disabled it by a SetActive(false)

    And it seems, cause I can reproduce it 100% that it occured during this kind of loop cause at the end of the animation we get this :


    Code (CSharp):
    1. 0x00000001417713DD (Unity) UI::CanvasRenderer::CanvasHierarchyChanged
    2. 0x000000014025C0E1 (Unity) MessageHandler::HandleMessage
    3. 0x000000014025C7EE (Unity) GameObject::SendMessageAny
    4. 0x00000001407C1731 (Unity) Transform::BroadcastMessageAny
    5. 0x00000001407C17AE (Unity) Transform::BroadcastMessageAny
    6. 0x00000001407C17AE (Unity) Transform::BroadcastMessageAny
    7. 0x00000001407C17AE (Unity) Transform::BroadcastMessageAny
    8. 0x00000001407C17AE (Unity) Transform::BroadcastMessageAny
    9. 0x00000001407C17AE (Unity) Transform::BroadcastMessageAny
    10. 0x00000001407C17AE (Unity) Transform::BroadcastMessageAny
    11. 0x00000001407C17AE (Unity) Transform::BroadcastMessageAny
    12. 0x000000014176FC70 (Unity) UI::Canvas::RemoveFromManager
    13. 0x000000014039CBC7 (Unity) Behaviour::Deactivate
    14. 0x000000014025D9B5 (Unity) GameObject::ActivateAwakeRecursivelyInternal
    15. 0x000000014025D7FB (Unity) GameObject::ActivateAwakeRecursivelyInternal
    16. 0x000000014025D7FB (Unity) GameObject::ActivateAwakeRecursivelyInternal
    17. 0x000000014025D7FB (Unity) GameObject::ActivateAwakeRecursivelyInternal
    18. 0x000000014025DABE (Unity) GameObject::ActivateAwakeRecursively
    19. 0x000000014025DF55 (Unity) GameObject::Deactivate
    20. 0x000000003DB26525 (Mono JIT Code) (wrapper managed-to-native) UnityEngine.GameObject:SetActive (bool)
    21. 0x0000000002C4C5D1 (Mono JIT Code) [D:\Project\MyHemisForFlexom\UnityProject_Android\Assets\Assets_MyHemis\Scripts\Application\ApplicationElements\Menus\Modules\MenuModuleSlider.cs:628] MenuModuleSlider:OnComplete ()
    So it can be in relation with your question concerning pooling.
    So my main question is : Have you a solution except fixing the engine ?
    Could it be due to our (maybe) to deeper hierarchy ?
    Could it be due to some CanvasGroup / Canvas / CanvasManager issue due to a big hierachy changing ?

    EDIT :
    We almost find the incriminated part of our code that create this.
    It's indeed due to a pooling issue. No SetActive are used in that case only moving element from our menu to the pool and from the pool to our menu.
    More information tomorrow cause I have to leave but I'll keep you in touch !
     
    Last edited: Apr 9, 2018
  17. Ubiant

    Ubiant

    Joined:
    Oct 17, 2017
    Posts:
    6
    Final word (til the next one :p ) : Moving to Unity 2017.4.1f1 seems to solve our issue.
     
    leemin and Menion-Leah like this.
unityunity