Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: clappin on October 01, 2012, 05:34:15 PM

Title: Shuriken particles always drawn behind UIButton. Need help.
Post by: clappin on October 01, 2012, 05:34:15 PM
I have added a shuriken particle effect as a child to a UIButton object. Both button and particle effect are in the same layer.  No matter what I do to the Z of the particle effect, it is always drawn behind the button.  What am I supposed to do to have the particle effect on top of the button?

UI Root (2D)->Camera->Anchor->Panel->Button->ParticleEffect

Layer=UI
ParticleEffect Z = -1.0
Button Z = 0
Title: Re: Shuriken particles always drawn behind UIButton. Need help.
Post by: ArenMook on October 01, 2012, 05:37:01 PM
Sounds like the shader used by your particle system is always drawn before the NGUI's Unlit/Transparent Colored queue. Adjust your particle shader accordingly.
Title: Re: Shuriken particles always drawn behind UIButton. Need help.
Post by: filippopotamus on October 01, 2012, 08:50:09 PM
I have a similar issue. I have a background sprite and an ammo sprite. Both the are in the same atlas. I want to add a shuriken particle system in between them (to make the ammo look like it is glowing). So the order would be, from back to front:

Background | Particle System | Ammo

The problem is, since the background and ammo are both drawn on the same draw call (because they are in the same atlas), when I mess with the Z of the particle system, it is always either behind or in front of both, but never in between.

Any idea how I could solve this problem without putting the background and ammo sprites in different atlases?

Thanks!
Title: Re: Shuriken particles always drawn behind UIButton. Need help.
Post by: filippopotamus on October 01, 2012, 08:58:36 PM
Nevermind, on the main panel I checked the "Depth Pass" check box and that did the trick. Thanks for making a fantastic tool.
Title: Re: Shuriken particles always drawn behind UIButton. Need help.
Post by: clappin on October 02, 2012, 08:27:02 AM
Sounds like the shader used by your particle system is always drawn before the NGUI's Unlit/Transparent Colored queue. Adjust your particle shader accordingly.
This is exactly what the problem was.  Thank you so much for your help.
Title: Re: Shuriken particles always drawn behind UIButton. Need help.
Post by: kitgui on February 22, 2014, 01:11:54 AM
Sorry for raising an old thread, but I'm trying to figure out how to display particles over NGUI Sprites.

How do I affect the draw order of shaders?
Title: Re: Shuriken particles always drawn behind UIButton. Need help.
Post by: ArenMook on February 22, 2014, 11:08:32 AM
http://www.tasharen.com/forum/index.php?topic=776.msg34546#msg34546