I’ve got this really strange bug where a group of UI objects with a mask is drawing on top of things it shouldn’t… but only sometimes.
Here’s a screen shot of it in the “bad” state:
That “FadeOutGroup” is has both Image and CanvasGroup components; normally it’s solid black, used for fading out between scene changes, but for the sake of testing I’ve replaced the sprite with the giant green emerald. You can see that the Alpha is currently set to 1, so that whole Play/Options/Treasure menu should be covered up by the emerald, but it’s not.
The Mask seems pretty clearly the culprit here, because if I disable the Mask component on Menu, the problem goes away (the whole menu draws behind the FadeOutGroup).
But here’s the weird thing… it also depends on what else is among the children of that Menu object, and whether they’re enabled or not. I can manipulate these manually while the game is paused (and get the same effects I see when I manipulate them with code at runtime). Observations:
- If I deactivate the XHighlight object (which has just an Image), the bug goes away.
- If I add a clone of XHighlight, and deactivate them both, the bug goes away.
- If just one of the two clones is active, the bug occurs.
- If both of the clones are active, the bug goes away. (What the frick?)
- If, while the bug is occurring, I deactivate any of the buttons, Tile, or Border (basically any child at all), the bug goes away.
It’s almost like it depends on whether the number of active children is odd or even. But not quite (testing that theory, most combinations made the bug go away). And when I deleted the treasure button, the behavior changed… now the bug occurs only when both XHighlight and its clone are active.
I’m thoroughly confused; the behavior is so erratic that I can’t even find a workaround at the moment.
Is this a known bug? (It sounds vaguely similar to the bug mentioned at the end of this thread, but it’s hard to tell.) Anybody know how to better describe the conditions under which it occurs?