Author Topic: non-NGUI elements between NGUI elements  (Read 4495 times)

Lelka

  • Guest
non-NGUI elements between NGUI elements
« on: November 01, 2013, 02:06:44 AM »
I want to place non-NGUI element (Smooth moves animation) between two NGUI elements (UISprite). But Smooth moves animation always under all NGUI elements ( I tried to add UIPanel on Smooth moves animation, but it did not help me). How to do it?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: non-NGUI elements between NGUI elements
« Reply #1 on: November 01, 2013, 06:24:58 AM »
You need to use a shader with a render queue that would sit in-between of the NGUI elements. NGUI geometry is drawn on render queues 3000 and higher. First draw call uses RQ 3000, next one -- 3001, etc.

rambo406

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1
    • View Profile
Re: non-NGUI elements between NGUI elements
« Reply #2 on: May 31, 2014, 11:24:00 PM »
When you mention about changing the renderQueue, I tried to use the following codes to change it, it still doesn't work.
Animation of "Smooth moves" still behind NGUI controls.

  GetComponent<SkinnedMeshRenderer>().materials[0].renderQueue = RenderQueue;
        GetComponent<SkinnedMeshRenderer>().material.renderQueue = RenderQueue;

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: non-NGUI elements between NGUI elements
« Reply #3 on: June 01, 2014, 05:20:04 PM »
I don't know what shader smooth moves is using. Not everything can be inter-mixed like that, and Unity 2D's sorting order is another thing altogether. Render queue modifications must be done on both NGUI and on whatever you're trying to adjust. Useful FAQ sticky has an example script that adjusts the render queue of a renderer. Note that NGUI's panels must also be adjusted with an explicit render queue set.