Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Unity UI Canvas hierarchy/drawing order broken after upgrade to Unity 2021.3

Discussion in 'UGUI & TextMesh Pro' started by solinvictus1313, Jul 14, 2022.

  1. solinvictus1313

    solinvictus1313

    Joined:
    Mar 31, 2020
    Posts:
    7
    Hi everybody,

    I recently upgraded my long-running project from Unity 2020.3.34f1 to 2021.3.6f1.
    After figuring out a couple of small and unrelated issue, I ran into problems with the UI that I seemingly can't figure out.

    The game's UI is based on a single Canvas (Screen Space - Overlay) GameObject hierarchy that had no issues in Unity 2020.3. After the upgrade to 2021.3, the drawing order of Canvas object becomes severely broken after changing the hierarchy. The issue appears both in the Editor and on mobile devices.

    After tapping around a couple of times (where GameObjects with their own Canvas components are enabled or disabled, or popup-like Prefabs are instantiated or destroyed), the Canvas' hierarchy seems to have no correlation to the game object hierarchy anymore - stuff is unexplicably drawn on top of each other in the wrong order. I haven't ever touched sorting layers or anything else, it was all working fine just based on the GameObjects' hierarchy. Similarly, when the drawing order is broken, input events either pass through objects or are not received by top-most objects anymore.

    None of this has happened before the upgrade to 2021.3, and I'm not sure even where to start looking.

    Has anyone encountered something similar before? I'd be super grateful about any hint, thanks in advance.

    Cheers
    solinvictus1313
     
    Last edited: Jul 14, 2022
    Neiist, sejton, Erveon and 4 others like this.
  2. andrewpey

    andrewpey

    Joined:
    Sep 21, 2014
    Posts:
    10
    It seems to be a regression in 2021.3.6. We've submitted a bug report for it a few days ago (for Unity guys, it's https://unity3d.atlassian.net/servicedesk/customer/portal/2/IN-10057).

    No such issue is present in 2021.3.5, but that version has another issue (https://issuetracker.unity3d.com/is...-image-which-is-set-as-buttons-target-graphic) which I believe they fixed in 2021.3.6 and somehow that fix introduced this new regression.

    Also, I believe this is the first mention of this issue: https://forum.unity.com/threads/rel...ui-even-at-runtime.846772/page-5#post-8265315
     
  3. JudahMantell

    JudahMantell

    Joined:
    Feb 28, 2017
    Posts:
    473
    Seeing this too. I updated my project from 2021.3.2 to 3.6 and suddenly the canvases all break!
    Really hoping there's a fix soon.
     
    Tony_Max, nicolasvei and andrewpey like this.
  4. jussch

    jussch

    Joined:
    Jan 2, 2018
    Posts:
    7
    Also seeing this issue after upgrading from 2021.1.28 to 2021.3.6
     
    nicolasvei and andrewpey like this.
  5. Thermos

    Thermos

    Joined:
    Feb 23, 2015
    Posts:
    148
    Toggle on [sorting override] on every sub canvas solves problem in 2021.3.6.
     
  6. JudahMantell

    JudahMantell

    Joined:
    Feb 28, 2017
    Posts:
    473
    Thanks for the note! That definitely is useful in the meantime while the actual bug is fixed.
    I believe the default behavior for canvases is that the order is defined by the hierarchy, which in my case is very important. Needing to set sorting override for every canvas is kinda a stop-gap solution. IMHO, anyway.
     
    nicolasvei likes this.
  7. adbourdages

    adbourdages

    Joined:
    Jul 8, 2012
    Posts:
    75
    What I see in our project after upgrading from 2021.3.5f1 to 2021.3.6f1 is that the input system gets confused. Elements are drawn in the correct order. There are no visual clue something is off. However, after interacting with the elements, showing/hiding different in-game screens, the UI eventually stops responding to hovers and clicks. Playing with this in the editor, I discovered that some of the canvases that were drawn in the back are in fact blocking/eating the mouse/touch input.

    Overriding the sorting order has a positive impact but I'm not sure it is a complete fix and anyway there is too much unknown on what else got messed up in the UI to continue with 2021.3.6.

    Too bad, I really needed those Android crash fixes :-/
     
    Last edited: Jul 21, 2022
  8. JudahMantell

    JudahMantell

    Joined:
    Feb 28, 2017
    Posts:
    473
    Yeah, that's exactly my findings too. Hopefully they'll release a patch soon!
     
    nicolasvei likes this.
  9. andrewpey

    andrewpey

    Joined:
    Sep 21, 2014
    Posts:
    10
  10. Erveon

    Erveon

    Joined:
    Sep 15, 2019
    Posts:
    13
    How are these issues slipping past QA and being introduced into LTS builds? What a joke. Guess that's what we get when Unity can't even make a game in their own engine and cans the developers behind it.
     
  11. bbjones

    bbjones

    Joined:
    Feb 1, 2016
    Posts:
    85
    Confirmed this update broke all of my UI by upgrading to 2021.3.6f1, from 2021.3.1f1, Windows10. Can't run my game in playmode/builds since none of my UI responds.

    Needed to upgrade to 6f1 to try and find a fix for other previously broken features coming out in the earlier 2021.3.1f1, such as builds no longer targeting your main monitor, which is another unacceptable bug.

    EDIT: Note my issues seems somewhat different than other's being reported.
    I do generally use gameobject.setActive to control what parts of my UI show up, and at this point I can see all of the UI I expect to see. I just can't interact with any of it. No mouse hover, no mouse click, so I can't get past my main menu at the start to even evaluate the rest of my UI.
    I have filed a bug as well.
     
    Last edited: Jul 24, 2022
  12. bbjones

    bbjones

    Joined:
    Feb 1, 2016
    Posts:
    85
    Based on some limited testing I can confirm this worked to fixed my main menu, which was a sequence of canvases for each menu stage with visibility controlled via gameobject.SetActive.

    I luckily was using a common ShowView() method where I activated all of my canvas game objects, so added this line of code and now my UI is interactable again.

    Code (CSharp):
    1. view.GetComponent<Canvas>().overrideSorting = true;
    Before that I did see my UI in the game window, but it did not render in the scene view in the editor.
     
    andrewpey and Erveon like this.
  13. Erveon

    Erveon

    Joined:
    Sep 15, 2019
    Posts:
    13
    We have the same exact issue as what you're reporting, so you're not alone.
     
    andrewpey likes this.
  14. kcastagnini

    kcastagnini

    Joined:
    Dec 14, 2019
    Posts:
    61
    Lost a day on such an issue, I should have never upgraded from 2019 LTS, everything is getting slower and more broken with each release.
     
  15. Erveon

    Erveon

    Joined:
    Sep 15, 2019
    Posts:
    13
    New Unity 2021 version released. Happy to see it in the patch notes. Not happy to see it in the "known issues" section. Baffling. Between this and the countless other areas where Unity is falling behind or literally making its engine worse, I'm definitely advocating against Unity for future projects at our studio.
     
    kcastagnini likes this.
  16. OscarLeif

    OscarLeif

    Joined:
    Jul 17, 2016
    Posts:
    69
    In Unity 2021.3.7 you can find this know issue.
    • uGUI: UI becomes not interactable after deactivating and reactivating Canvas (UUM-9258)
    I was tired of found why my game stop working.
     
  17. Vincent454

    Vincent454

    Joined:
    Oct 26, 2014
    Posts:
    165
    Unity please ;_; I wanted to release an update to my game but sadly updated to this version and am afraid to downgrade as it usually causes problems even with smaller releases like that.

    Don't they have quality assurance, especially for lts releases?

    Sometimes (Right now) I wish everything was still Unity 5. It was fast, looked great with colorful icons and nice shading, didnt have the overcomplicated package system, didnt require you to install a unity launcher, had the asset store built in and didnt have 3 render pipelines and 5 releases that they had to maintain at once, which probably leads to bugs like this
     
    derkoi and Lars-Steenhoff like this.
  18. PanthenEye

    PanthenEye

    Joined:
    Oct 14, 2013
    Posts:
    2,049
    Every update fixes something critical but then breaks another thing that is also critical to the project. They've been backporting some of the new bugs to 2020LTS as well. They aren't doing even basic QA for new releases; it seems.

    The scheduled releases are worthless when they don't contribute to stability. Major known issues are persisting for multiple minor versions of LTS. What's going on? Are the teams not yet familiar with the new bug reporting system? Or is QA dealing with a huge backlog due to migration to another service? Something has changed recently.
     
    ArthurAulicino likes this.
  19. bbjones

    bbjones

    Joined:
    Feb 1, 2016
    Posts:
    85
    Vincent454 likes this.
  20. VirtualDestructor

    VirtualDestructor

    Joined:
    May 3, 2014
    Posts:
    44
    Just discovered this issue is impacting me as well.
     
  21. Hyp-X

    Hyp-X

    Joined:
    Jun 24, 2015
    Posts:
    431
    Issue impacts us as well (subscribes to the thread)
     
  22. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    3,512
    Ran into this one this week after updating to 2021.3.6f1 from 2021.3.4f1. The declining stability of builds is starting to make our team consider if we need to be avoiding new versions altogether and stick with outdated but less problematic Editor builds.
     
    PanthenEye, Shikshen and Vincent454 like this.
  23. OscarLeif

    OscarLeif

    Joined:
    Jul 17, 2016
    Posts:
    69
    Last edited: Feb 22, 2023
  24. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    3,512
    For what it's worth, we resolved this in 2021.3.6f1 by ensuring all of our Canvases had Sorting Group components on them. Canvases at the same level in the hierarchy are assigned Sorting Layers to appropriately order them. Each nested Canvas also had its Override Sorting checkbox enabled and a Sort Order assigned that matches its Order in Layer value in the Sorting Group.

    This seems to have resolved the issue for now and we're once again seeing our various menus again.
     
  25. defStudios

    defStudios

    Joined:
    Aug 5, 2016
    Posts:
    2
    2021.3.8f1 - still not working ;)
     
    OscarLeif likes this.
  26. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    3,512
    Do you mean that my solution isn't working for your case? I don't imagine they broke it further with the latest version, so the workaround should function the same. Are you certain you have your Sorting Layers setup properly, Sorting Groups on all Canvas components, and any nested ones have their Override Sorting enabled with Sort Order matching the Sorting Group value? And that all of your layers are ordered properly so that your deeper Canvases have higher values than the lower ones?
     
  27. sacb0y

    sacb0y

    Joined:
    May 9, 2016
    Posts:
    867
    This was my solution until I realize this is also F***ing with raycast padding if you had a parent object.
    upload_2022-8-14_0-30-1.png

    Here my buttoncontainer had a raycast override that made the button larger than it looked. Also the "arrow" has an animation that scales it to make it appear to spin.

    Now somehow the arrow is the raycast target and it's area scales to the animation making clicking it unreliable.

    Man if only unity had a project that would test if their update would break everyones UI.

    At this point my game basically doesn't work, they fixed windows touch apparently but broke the whole ui right after that :mad:
     
    Rodolfo-Rubens and RogDolos like this.
  28. PanthenEye

    PanthenEye

    Joined:
    Oct 14, 2013
    Posts:
    2,049
    I was looking into raycasting issues as well, but couldn't find anything mentioned in the forums. Ended up raycasting into specific layers since the raycast was returning the wrong hits. I haven't had the time to get to the bottom of this, but this seems to extend beyond UI to regular gameobjects with colliders as well, which still might be UI related since I have worldspace UI in the scene as well.
     
  29. sacb0y

    sacb0y

    Joined:
    May 9, 2016
    Posts:
    867
    I seemed to get results by adding a graphic raycaster component to the parent object, which deffinitely wasn't needed before. On top of the override sorting cause i've had all kind of issues adding that.
     
    Schneider21 likes this.
  30. sacb0y

    sacb0y

    Joined:
    May 9, 2016
    Posts:
    867
    This problem has also impacted masking somehow?

    A masked dropdown menu was not visible until i added the sorting layer. my god.
     
  31. Devil_Inside

    Devil_Inside

    Joined:
    Nov 19, 2012
    Posts:
    1,117
    JFC, this is LTS and you get S*** like this? Mindblown!
     
    Menion-Leah likes this.
  32. B1QQ

    B1QQ

    Joined:
    Aug 16, 2018
    Posts:
    10
    bruh wtf is going on, I just upgraded from 2021.2 to 2021.3 and all my UI is broken and my character is looking like big chungus
     
  33. ltomov

    ltomov

    Joined:
    Aug 3, 2017
    Posts:
    96
    Another workaround that seems to work is to disable and reenable the Canvas component.

    UPDATE: actually that seems to work only when done through the inspector, not through code. But enabling and disabling after a while the overrideSorting attribute works also in code.
     
    Last edited: Aug 22, 2022
  34. yuliyF

    yuliyF

    Joined:
    Nov 15, 2012
    Posts:
    194
    2021.3.4 is work fine, 2021.3.8 is broken
     
  35. Devil_Inside

    Devil_Inside

    Joined:
    Nov 19, 2012
    Posts:
    1,117
    Yeah, it was introduced in 2021.3.6 I believe.
     
  36. VirtualDestructor

    VirtualDestructor

    Joined:
    May 3, 2014
    Posts:
    44
    Any ETA for a fix? I'm trying to decide whether to downgrade to 2021.3.5 since I want to release an early access version of my game within two weeks.
     
  37. OscarLeif

    OscarLeif

    Joined:
    Jul 17, 2016
    Posts:
    69
    Check the bug report

    I'm sure it's more safer to use 2021.3.5f1 that was the lastest stable version. (Unless you also need some fix from beyond).

    Update 21-Feb-2023
    If you read this.
    This was fixed after 2021.3.10f1.
    Just download a new version
     
    Last edited: Feb 22, 2023
  38. Devil_Inside

    Devil_Inside

    Joined:
    Nov 19, 2012
    Posts:
    1,117
    Yeah, it seems it wasn't even approved for 2021.3.9.
     
  39. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,255
    Use LTS they said. Yeah right. Unity is getting more incompetent by the day.
     
  40. ltomov

    ltomov

    Joined:
    Aug 3, 2017
    Posts:
    96
    Is there a release date for 2021.3.9? I see the fix has been approved now.
     
  41. bbjones

    bbjones

    Joined:
    Feb 1, 2016
    Posts:
    85
    Also waitng...
     
  42. ltomov

    ltomov

    Joined:
    Aug 3, 2017
    Posts:
    96
  43. karliss_coldwild

    karliss_coldwild

    Joined:
    Oct 1, 2020
    Posts:
    595
    To be more precise the intended update schedule for LTS releases is once every 2 weeks during first year of LTS (currently for 2021.3) and once a months after the first year (currently for 2020.3 and 2019.4). Although it's not rare for the planned 2 week cycle stretching into 3 weeks. The update schedule mentioned at the top of https://unity3d.com/unity/qa/lts-releases?version=2021.3 and also some of the LTS posts like this https://blog.unity.com/news/introducing-unity-2021-lts
     
  44. Vincent454

    Vincent454

    Joined:
    Oct 26, 2014
    Posts:
    165
    Lets hope they release the update today
     
    Last edited: Aug 26, 2022
    Chrisdbhr likes this.
  45. feika

    feika

    Joined:
    May 10, 2018
    Posts:
    1
    :(
     
    Vincent454 likes this.
  46. Vincent454

    Vincent454

    Joined:
    Oct 26, 2014
    Posts:
    165
    :(
     
    feika likes this.
  47. starstablesimon

    starstablesimon

    Joined:
    Nov 24, 2016
    Posts:
    18
  48. Laumania

    Laumania

    Joined:
    Jun 27, 2012
    Posts:
    221
    I'm here too... upgraded from v2021.1.22f1 to v2021.3.8f1 - to see if they finally have fixed the particle system GPU instancing bug. It seems like it...however now my entire UI is broken.
    Lost 3-4 hours now trying a lot of things, as I thought it was one of the packages Im using that caused it....but it was a native Unity bug...sweet.... :(

    Seems like it's fixed very soon now - crossing fingers they dont break anything me game depending on in that fix :)
     
  49. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,255
    Welcome! I'm actually scared to update again. Lost 2 days returning back to my backup after trying to update
     
  50. SampsaPlaysome

    SampsaPlaysome

    Joined:
    Oct 20, 2019
    Posts:
    33
    Hello,

    we tried to do an update from 2019 to 2021.3.8f1 and our UI completely broke down. Took a while to figure it out, and it appears that the only way to fix this would be to add Canvas components to all of the UI elements inside the master Canvas, and have sorting order override enabled to them. Otherwise the draw order would be a mess. Ironically so far the UI seems to be the only broken thing in our upgrade which actually jumps over a major version.

    However, the system does not naturally support nested canvases, so in order to have everything draw in correct order you need to meticulously assign depth order to make it work. Basically you really do need an UI manager that handles assigning the depth override by your specification. If you're using Doozy like we do, good luck. It uses nested canvases quite extensively.

    This magnitude of regression is simply unacceptable. This is LTS version.
     
    wickedwaring and Menion-Leah like this.