Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: filippopotamus on July 31, 2012, 11:40:11 AM
-
I am having a depth issue between 2 widgets.
A) One is a panel where I have multiple UISprites, one of which is constantly changing it's alpha as the game goes on. This set of sprites are children of a UIPanel. This panel is the HUD of the game.
B) The other is a single UISprite used for a Achievement Banner that drops down from the top of the screen for a couple of seconds then goes back up and disappears. This is supposed to cover part of the HUD as it comes down. This is not part of a UIPanel, although I did try making it a child of a UIPanel but it didn't fix the issue.
Both A and B are in the same UIAtlas. The problem I am having is, sometimes B comes down behind A, sometimes in front, and sometimes it comes in front and half way through the animation A pops back in front. I have played around with the depth as well as Z on both. And it seems no matter what I do, these keep going back and forth. I need B to always be in front.
Any thoughts?
-
Is it possible that the constant alpha change of one of the UISprites from A is triggering it to display in front?
-
Check the FAQ, the "depth vs Z" issue is explained very thoroughly. To sum it up: different panels mean different draw calls, so you have to manually move one of the panels forward (-Z) to bring it in front of another, thus telling Unity which one is in front. Without it, it's all random.
-
I am aware of that, and that is why I mention about that I have played around with both depth as well as Z, without any success. :'(
-
After playing some more with the UIPanel parenting I think I fixed it. I say I think because before it worked sometimes and sometimes it didn't. Now it seems to be working. I'll post again if the issue comes back. Thanks for the help! Cheers!