Z sorting problems with nested canvases in Unity 5.1.0

We updated our project to version 5.1.0 just the other day and the first thing we noted was that our UI wasn’t showing up anymore.

It looks like hierarchical sorting doesn’t apply to nested canvases anymore. Checking the ‘overrideSorting’ flag does bring the ui elements back into view. But we needed to check this flag for every nested canvas we have in the scene which seems silly. And even than we have sorting errors with dynamically enabled elements, even when their parents have a higher sorting order than the parent of the element that is falsely drawn in front instead.

Another thing I noticed is that the game view rendering differs from the scene view rednering in relation to z sorting which makes this even more infuriating.

Hi Denis,

There are some issues in UI sorting in 5.1 that we are aware of. The UI team are working on this and we hope to have a fix out as a patch. For the moment try disabling sprite packing(if you are using it) or revert back to 5.0.

Hey Karl,
glad to hear it and thanks for the quick response. Can you give an estimate as to when this patch might be ready? (We have a milestone coming up in two weeks…)

We are not using the sprite packer btw.

Its hard to say how long and if the fix would help, you may have a different issue. I suggest you report it as a bug and then we can investigate - Unity QA: Building quality with passion
Keep an eye on the patch releases to see if they contain UI fixes, if they do try them out.
Are you able to use 5.0 whilst you wait?

We are facing the same issue here + an issue with Physic Raycaster mask vs UI. Hope the patch will fix it, glad to hear you are working on it. :slight_smile:

I will do that when I find the time and the issue isn’t resolved by then.

We could switch back but we want to avoid it. We’ll stay with 5.1 for now and hope for the best :wink: And thanks again.

I’ve isolated and reported a bug related to sorting in 5.1 (#703250). I’ve got a reply the next day from the QA team that the bug was fixed and will appear in 5.2

But 5.2 is probably several months away, can’t this fix be included in one of the patch releases instead?

I’ve reverted back to 5.0 for now as well… but I was not only seeing the widespread UI Z sorting issues, but the same exact UI scene that runs with 15-17 batches in 5.0 hovers around 40-55 batches in 5.1.

I’m sure it’s directly related to whatever got fumbled on the sprite packing end, but figured I’d chime in with that for what it’s worth.

(edit: I realize this was never claimed to be fixed, but to be clear to anyone else finding this thread, I was using 5.1.0 and 5.1.0p1 and seeing all glitches in both before I punted and downgraded. Wouldn’t consider either of those releases ready for show-time from the UI side.)

Yep, I opened a thread for this issue but everything is related to this : http://forum.unity3d.com/threads/drawcalls-go-up-with-the-latest-version-of-unity-4-6-4-6-4p2.318742/

Thanks for the head’s up. Good I wasted my morning banging my head on this, seeing how we knowingly pushed a release out the door that had non-trivial and fully documented bugs during beta.

Well played Unity…

same to me , a lot of elements disappear on 5.1 … I got to roll back to 5.0

Chipping in here, I thought I had fixed this but to no avail. My entire app is currently canvases with UI elements (mostly buttons and input boxes) and on button presses there is a horrible flicker with what looks like some kind of garbage from a buffer flickering on the screen and all UI elements dissapear.

As 5.1 fixes some issues for some devices but breaks it for others… I am now needing to have 2 versions of unity and doing 2 releases of everything until it’s sorted. A patch would be greatly appreciated before 5.2 which, as someone mentioned, is probably months away.

Exact same issue here … and from what I can tell, no patch just yet. 5.1.1p3 doesn’t have a solution for it yet.

Trying a downgrade to 5.0 now as 5.1.0 still had the issue.

This issue isn’t over with 5.1.1p3 ? Can someone else confirm this ?

5.1.1p1 fixed it for me, so you should definitely give 5.1.1p3 a go.

I didn’t manage to reproduce it since p2 (didn’t download p1) so that’s why I was asking. Thanks ! :slight_smile:

Hey all;
Just started work on a UI-heavy prototype - apologies if this isn’t the right place to put this, but something that helped me keep multiple canvases behaving correctly was to child those canvases to panels, with the panels having the “Mask” component added.

http://docs.unity3d.com/Manual/script-Mask.html

For my work, I had two “viewports” that could be located anywhere, but contained multiple panels/elements underneath a parent canvas (for panning and scrolling) - so by making this “clipper” panel the parent, I could still manipulate the canvas underneath it, but only “saw” what the clipper panel allowed through.

I wasn’t able to confirm if in the Scene Editor if they’re still stacking on top of one another (it seems to be bugged, I actually can only see my UI in my Game window)

Hope this helps! :slight_smile: