Author Topic: Render Queue Issue  (Read 3487 times)

schwarzenego

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 30
    • View Profile
Render Queue Issue
« on: January 12, 2016, 04:50:17 PM »
Hey,

I've updated Unity to 5.3.1 and currently have NGUI 3.9.6 (just updated from the store) and something strange is happening. I got a particle system that I want in front of NGUI, and therefore, I have a shader that basically has "Queue"="Transparent+500", and whenever I want to use a particle in front of NGUI, I use this shader and thats it.

However... since the Unity update, which I dont know how but somehow screwed things up, now SOME materials with this shader are being drawn in front of NGUI, others arent. Same shader on all materials... its just not consistent. Tried raising the number to ridiculous amounts like Transparent+5000000 but no change at all...

Any clue as to how NGUI com possibly be drawn in front of something with a ridiculously high render queue? Btw I checked the Draw Call window and no panel is more than 3020˜ render queue...

Thanks in advance for the attention,
Cya

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Render Queue Issue
« Reply #1 on: January 13, 2016, 07:20:37 PM »
I actually had to ditch Unity 5.3 because I had too many weird issues with it. Even adding a simple bloom effect now adds a black bar on top of the screen. Did you try it with Unity 5.1 to see if the issue disappears? That was the last version of Unity 5 that worked without issues for me -- although all these issues were not in NGUI. Haven't seen any NGUI issues yet aside from API obsoletion I had to fix.

PoN

  • Full Member
  • ***
  • Thank You
  • -Given: 1
  • -Receive: 4
  • Posts: 111
    • View Profile
Re: Render Queue Issue
« Reply #2 on: February 29, 2016, 05:24:08 AM »
Hey,

I've updated Unity to 5.3.1 and currently have NGUI 3.9.6 (just updated from the store) and something strange is happening. I got a particle system that I want in front of NGUI, and therefore, I have a shader that basically has "Queue"="Transparent+500", and whenever I want to use a particle in front of NGUI, I use this shader and thats it.

However... since the Unity update, which I dont know how but somehow screwed things up, now SOME materials with this shader are being drawn in front of NGUI, others arent. Same shader on all materials... its just not consistent. Tried raising the number to ridiculous amounts like Transparent+5000000 but no change at all...

Any clue as to how NGUI com possibly be drawn in front of something with a ridiculously high render queue? Btw I checked the Draw Call window and no panel is more than 3020˜ render queue...

Thanks in advance for the attention,
Cya

Hi, i used this code in my project, there is about SortingOrder of Renderer.

  1. using UnityEngine;
  2.  
  3. public class RenderQueueModifier : MonoBehaviour
  4. {
  5.     public enum RenderType
  6.     {
  7.         FRONT,
  8.         BACK
  9.     }
  10.  
  11.     public UIWidget m_target = null;
  12.     public RenderType m_type = RenderType.FRONT;
  13.  
  14.     private Renderer[] _renderers;
  15.     private int _lastQueue = 0;
  16.  
  17.     private void Start()
  18.     {
  19.         _renderers = GetComponentsInChildren<Renderer>();
  20.     }
  21.  
  22.     private void LateUpdate()
  23.     {
  24.         _lastQueue = m_type == RenderType.BACK? -1: 1;
  25.        
  26.             foreach (Renderer r in _renderers)
  27.             {
  28.                 r.sortingOrder = _lastQueue;
  29.             }
  30.        
  31.     }
  32. }
  33.  

This component should be attach to a root gameobject which, contains child gameobjects with ParticleSystem component.
-Root (With this script RenderQueueModifier component)
   ---- childGameObjectWithParticleSystemComponent1
   ---- childGameObjectWithParticleSystemComponent2
   ---- childGameObjectWithParticleSystemComponent3
   ...

Hope this helps to you.
Worked on Doc&DogAge Of Fury 3D. Actually working on WarMach.