Author Topic: Particle effects on NGUI  (Read 16500 times)

biggestgeek

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 11
    • View Profile
Particle effects on NGUI
« on: December 18, 2013, 12:56:38 AM »
Hey Guys,

I'm thinking of adding particle elements onto NGUI as a form of feedback for the player. Any idea how I should be going about doing it?

I know the particle system in Unity does not support prefabs so I can't place an sprite prefab into it. And just placing the particle generator onto the NGUI layer itself causes sorting issues.

Any help appreciated. Thanks!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Particle effects on NGUI
« Reply #1 on: December 18, 2013, 10:24:06 AM »
You can control the draw order by setting the Render Queue on the NGUI's panels.

biggestgeek

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 11
    • View Profile
Re: Particle effects on NGUI
« Reply #2 on: December 30, 2013, 01:37:52 AM »
Hey Aren,

Would you kindly explain further? I've currently placed a particle prefab from Unity's standard assets under a panel script which has a RenderQ Start At 3000. The particle seems to be over some sprites but other sprites seems to be overlapping it.

Currently the prefab is a child of the panel GO.

Thanks!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Particle effects on NGUI
« Reply #3 on: December 30, 2013, 01:40:57 AM »
All panels create draw calls on specific render queues. By default it's draw queue of 3000 for the first one, 3001 for the second, etc. You can change this by specifying explicit draw call numbers on the UIPanel.

You can alter the render queue of your particle system by using a script like the one I posted here: http://www.tasharen.com/forum/index.php?topic=776.msg34546#msg34546

biggestgeek

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 11
    • View Profile
Re: Particle effects on NGUI
« Reply #4 on: December 30, 2013, 02:27:23 AM »
Hey Aren,

Am I right to assume that the NGUI Draw Calls only detect UISprites and not materials in Unity? As when I click on the Show Draw Calls button it does not show the particles in which I am using but shows another texture which I added for testing purposes.

As currently I'm using the Particle System in Unity itself that uses Materials and not prefabs. Is there anyway to work around this or any suggestions you would have?

Thanks!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Particle effects on NGUI
« Reply #5 on: December 30, 2013, 01:05:39 PM »
Draw calls get created based on materials. NGUI doesn't batch particles, so not sure what you mean. Particle system does not derive from UIWidget. NGUI won't pick it up. Particle system renders itself. NGUI widgets don't render themselves.