Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: flavoredCoffee on September 11, 2013, 06:00:41 PM

Title: UILabels always on top of UITexture
Post by: flavoredCoffee on September 11, 2013, 06:00:41 PM
I'm trying to create a fade out/in overlay when I switch levels.  I'm creating a UITexture object in a script and giving it a black texture with alpha 0, and then fade to alpha 1.  The UITexture object has it's depth value set to 100 and it's Z position to just before the camera Z.

As I expected, the texture covers everything on the screen, except the UILabels.  (FYI - dynamic font in case it matters).

The UITexture is not using the atlas.  The UITexture has a lower Z value than any of the labels.  It has a higher depth.  It's been in its own panel, or the same panel as the labels - makes no difference.  I guess I could add another 2D camera and have it on top of everything, but I'd rather not do that unless it's the only option.

The UITexture will cover up a button's background image, but the label is drawn after the texture.  Any other ideas on how to correct this?

Thanks

FC
Title: Re: UILabels always on top of UITexture
Post by: Wumpee on September 11, 2013, 07:30:48 PM
Adding a separate camera isn't a bad option. There's no extra overhead as long as you have the clear flags set to "Don't Clear"

You could also try adjusting the Z depth of the panel you've attached the overlay to, rather than changing the Z depth of the UITexture overlay itself.
Title: Re: UILabels always on top of UITexture
Post by: flavoredCoffee on September 11, 2013, 11:56:36 PM
Ok -- I'll look into adding another camera -- I tried adjusting all the different Z options on each item with no luck.

I'll let you know how I get on.

FC
Title: Re: UILabels always on top of UITexture
Post by: nugao on September 12, 2013, 12:42:32 AM
Just change UITexture's shader from 'Unlit - Diffuse' to 'Unlit - Transparent Colored'.

Because the Transparent object always in front of the Opaque object, in other words the Opaque objects always render in front of the Transparent object in render queue.
Title: Re: UILabels always on top of UITexture
Post by: flavoredCoffee on September 12, 2013, 09:31:55 AM
Thanks!

That did the trick.

FC