Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Quads rendering behind other UI elements

A topic by Neon Specter created 1 day ago Views: 40 Replies: 6
Viewing posts 1 to 7
(5 edits)

I'm running into an issue where quads don't seem to be respecting sibling index and end up being invisible because they render behind other UI elements.

I'm using a single SSO canvas and the view (parent object) with the STM that has the quads has a higher sibling index than the view with the objects that are blocking the quads.  The text renders as expected - it's only the quads that render behind other stuff.

The objects that the quads are rendering behind are map hexes, which contain several UI Images; and only after setting the parent objects of these images to inactive do the quads show up (even disabling the Image component itself doesn't work - the parent has to be set inactive).

I have no idea why this only occurs with my map hexes and not any other UI objects. The only differences I can see is that the hexes have Masks and a polygon collider 2D; but the issue occurs even if all objects with Masks are disabled, and disabling the colliders doesn't make a difference either.  I'm not doing any re-parenting or any weird canvas stuff and I've double checked that parents and sibling indices are correct.

I'm not using any sprites - only UI Images. This issue occurs both with my custom quads as well as the default ones.  I'm using Unity 6000.0.58f2 with STM 1.14.7.

EDIT:  Same behavior with 1.14.11


Developer

Does this still happen if you add "STMMaskableGraphic" to the gameObject? If it's already there, does it still happen if you remove it?


Is this happening with The Universal or Ultra shader? Is there a difference between the two?


Also, please try toggling "ZWrite" off if you're using the Ultra shader!


So is this not happening with, for example, a default Image component in place of your map hexes? Are you doing anything with the zBuffer or rendering order with your map hexes...? Or are they *only* composed of masks and polygon collider 2Ds...? If it's just happening with that object, it's got to be some conflicting interaction between them...

(4 edits)

Adding STMMaskableGraphic didn't make any difference.  I'm using the Universal shader.  I tried Ultra with and without ZWrite and there's no difference.  The only possible thing I can think of is the info panel attached to each hex, which has it's own canvas - but I have those that completely disabled (parent object is inactive).

All I do with the map hexes is instantiate them from prefab (into a parent with lower sibling index than the object with the STM), and then set their sibling indexes within that parent.  I'm not doing anything else that would affect rendering; so this is indeed very mysterious.  
EDIT:  I can confirm it's not the info panels - I deleted all of them in play mode and it made no difference.

EDIT 2:  One other thing of note:  If I stretch a single map hex and all its children so that it spans the "underside" of the quads, it doesn't cause this issue. It's only when there's a bunch of them active that this issue occurs. If I disable ~2/3 of them, then the quads show up.  So it sort of seems like it's the number of images/objects that cause the issue.  There's 221 hexes in total, each with 9 Images (plus 24 on the info panel, but that's disabled for this test).

EDIT 3:  This actually has nothing to do with the hexes rendering on top of the quads. I did another test where I took a single hex that's far away from the quads and duplicated (at the same position) it a bunch of times.  Once I hit 80 hexes, the quads disappear.  Delete one and they show up again.  There's no layouts involved here.

Developer

This feels pretty bespoke, I might have to look at a sample scene to solve this... So quads disappear if there are 80 hexes, regardless of position relevant to eachother...? Hm, I wonder if it could be related to masking depth... but in that situation STM *should* print a warning to the console. iirc Unity can only handle a mask depth of 7.

It could be related to generated materials, but it could also be how STM grabs it's parent canvas for rendering - maybe something is getting mixed up there I can look into on monday. Not totally sure about that since it should be using the same info for text and quads, here.

Something very strange is going on.  I did another test where I deleted everything inside the hex (including scripts), so it's just a RectTransform and a CanvasRenderer.  It took over 1000 hexes, but I was able to reproduce the bug by duplicating these empty hexes.  I then had weird behavior where disabling them did not make the quads show up again - I had to actually delete them from the scene before the quads would show up again.

So I've reduced this problem down to:  Main Canvas --> Container with ONLY RectTransform --> Container with ONLY RectTransform (Image, script, canvas group all disabled) --> Container with ONLY RectTransform --> Hex object with only RectTransform and CanvasRenderer.  All scripts on or interacting with any of these objects have been removed or disabled.  The main canvas does have a canvas scaler, but I disabled that to no effect.  I also tried disabling everything except the STM on the object that has the quads.

Here's my STM settings:




Developer

What do the settings for your quad look like? Including import settings for the texture being used?

As mentioned earlier, I also tried with the default quads ("clap").