Author Topic: Shuriken particles always drawn behind UIButton. Need help.  (Read 14465 times)

clappin

  • Guest
Shuriken particles always drawn behind UIButton. Need help.
« 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

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Shuriken particles always drawn behind UIButton. Need help.
« Reply #1 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.

filippopotamus

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 31
    • View Profile
Re: Shuriken particles always drawn behind UIButton. Need help.
« Reply #2 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!

filippopotamus

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 31
    • View Profile
Re: Shuriken particles always drawn behind UIButton. Need help.
« Reply #3 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.

clappin

  • Guest
Re: Shuriken particles always drawn behind UIButton. Need help.
« Reply #4 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.

kitgui

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 26
    • View Profile
Re: Shuriken particles always drawn behind UIButton. Need help.
« Reply #5 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?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile