1
NGUI 3 Support / Re: Render Queue Issue
« 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.
- using UnityEngine;
- public class RenderQueueModifier : MonoBehaviour
- {
- public enum RenderType
- {
- FRONT,
- BACK
- }
- public UIWidget m_target = null;
- public RenderType m_type = RenderType.FRONT;
- private Renderer[] _renderers;
- private int _lastQueue = 0;
- private void Start()
- {
- _renderers = GetComponentsInChildren<Renderer>();
- }
- private void LateUpdate()
- {
- _lastQueue = m_type == RenderType.BACK? -1: 1;
- foreach (Renderer r in _renderers)
- {
- r.sortingOrder = _lastQueue;
- }
- }
- }
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.