Canvas hierarchy/drawing order broken after upgrade to Unity 2021.3

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

7 Likes

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 Jira Service Management).

No such issue is present in 2021.3.5, but that version has another issue (Unity Issue Tracker - Button isn't highlighted when the mouse re-enters the Button's Child Image, which is set as Button's 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: [Released] Advanced Procedural UI Generation! Create, modify, animate UI, even at runtime page-5#post-8265315

4 Likes

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.

3 Likes

Also seeing this issue after upgrading from 2021.1.28 to 2021.3.6

2 Likes

Toggle on [sorting override] on every sub canvas solves problem in 2021.3.6.

5 Likes

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.

1 Like

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 :-/

4 Likes

Yeah, that’s exactly my findings too. Hopefully they’ll release a patch soon!

1 Like

Update: Unity said they are aware of the issue and it’s tracked here: Unity Issue Tracker - UI Elements are no longer rendered when deactivating and reactivating the Parent GameObject

4 Likes

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.

6 Likes

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.

3 Likes

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.

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.

2 Likes

We have the same exact issue as what you’re reporting, so you’re not alone.

1 Like

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.

4 Likes

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.

1 Like

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.

4 Likes

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

3 Likes

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.

2 Likes

Got an email closing the bug I submitted as a duplicate, and tracking the fix here:

They also confirmed this is addressing the issue of the UI not being interactable.

1 Like

Just discovered this issue is impacting me as well.