Search Unity

Unity 2019 "fix for case 912396" broke our game UI

Discussion in 'UGUI & TextMesh Pro' started by vexe, Dec 2, 2019.

  1. vexe

    vexe

    Joined:
    May 18, 2013
    Posts:
    644
    Hi,

    so after updating to Unity 2019 (tested with 1.14f1 and 2.7f2) all our projects that were using Unity UI broke.

    Basically the way we do our UI is every UI element is its own gameobject, when we show/hide an element we just enable/disable its Canvas, and set the sibling index to be on top of the previously shown UI so it renders properly. Also, every UI element has its own GraphicRaycaster attached.

    This change https://bitbucket.org/Unity-Technol...chg-UnityEngine.UI/EventSystem/EventSystem.cs

    In particular:
    Code (csharp):
    1.  
    2. // comparing depth only makes sense if the two raycast results have the same root canvas (case 912396)
    3. if (lhs.depth != rhs.depth && lhs.module.rootRaycaster == rhs.module.rootRaycaster)
    4.                 return rhs.depth.CompareTo(lhs.depth);
    5.  
    The second half of the if expression was added new, it pretty much broke all our UI input/event detection. We basically show a "Click shield" behind our popups, the shield has a button/raycaster/canvas. We turn the click shield ON, then show the UI element on top. This in turn makes the ordering of s_Raycasters in RaycasterManager.cs be so that the raycaster for the shield is BEFORE the raycaster of the ui element, which is fine.

    But the click shield and the UI element each have their own raycaster, so their 'rootRaycaster' are different, which means that depth comparison now doesn't fire, and it goes through to the index comparison which yields the incorrect result saying that the shield should be processed before the ui element on top, because of the order they got added to the s_Raycasters in BaseRaycaster OnEnable/OnDisable. Now when I hover over the popup which is on TOP of the click shield, the EventSystem preview/debug info says that I'm still hovering over the clickshield which is wrong.

    If I just go to the shield and turn on/off the raycaster, it removes/readds it self to the raycasters list at the END now, which means the index comparison now works.

    The ordering of when things are turned on/off shouldn't matter, it should be driven by depth. I don't know what case that rooRaycaster was supposed to fix, the comment itself doesn't make any sense, it's mentioning "root canvas" but comparing "root raycaster". it's definitely breaking other things and is clearly not tested enough and should not have been released.
     
    Last edited: Dec 2, 2019
    BradTTS likes this.
  2. JuliusJ

    JuliusJ

    QA Minion of the month Unity Technologies

    Joined:
    May 20, 2015
    Posts:
    35
    Hi.

    Can you file a bug report with a project which can be used to reproduce this issue, if you haven't already, and share case ID? This would really help to investigate this.
     
  3. vexe

    vexe

    Joined:
    May 18, 2013
    Posts:
    644
    JuliusJ likes this.