Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: wijesijp on December 14, 2015, 11:37:15 PM

Title: How to get particle system above NGUI widget
Post by: wijesijp on December 14, 2015, 11:37:15 PM
In my game i have a NGUI UI widget at the bottom of the screen with some sprites etc. 
I what a particle system to appear above that.

I have seen this port about this. But I have trouble getting it to work
http://www.tasharen.com/forum/index.php?topic=776.msg34546#msg34546
 

I did following test to whether renderq can be used for my task ..

In my game I set UI Root Render Q to 3000 with sorting order 0
Then I add a NGUI sprite to the game

Then I add a sprite to the game and following script to it

  1.     Renderer ren;
  2.     public UIWidget target;
  3.  
  4.     void Start () {
  5.         ren = gameObject.GetComponent<SpriteRenderer>();
  6.         ren.material.renderQueue = 4000;
  7.     }
  8.        
  9.         void Update () {
  10.  
  11.         if (target == null || target.drawCall == null)
  12.             return;
  13.  
  14.         print("sprite " + ren.material.renderQueue);
  15.         print("NGUI " + target.drawCall.renderQueue);
  16.     }
  17.  

I can see from the output my sprite has 4000 render q and NGUI sprite has 3000 render q
but still my sprite is behind NGUI sprite ...

Can anyone provide some help ?
Title: Re: How to get particle system above NGUI widget
Post by: ArenMook on December 16, 2015, 03:07:54 AM
Are they drawn by the same camera?
Title: Re: How to get particle system above NGUI widget
Post by: wijesijp on December 16, 2015, 03:20:07 AM
NO
NGUI uses it's camera and my sprite use the Main camera in game
Title: Re: How to get particle system above NGUI widget
Post by: ArenMook on December 16, 2015, 10:34:26 PM
Well there's your problem then.

Two different cameras means it's completely impossible to make things intermix.

First one camera draws everything it sees, then another camera draws everything it sees. Logic.
Title: Re: How to get particle system above NGUI widget
Post by: wijesijp on December 16, 2015, 10:51:25 PM
Yes you are right
I add the particle layer to the NGUI camera and the code worked.