- Home /
How to force GUIText sorting?
I'm drawing black text under white text to get a bit of a dropshadow and outline.
On my PC this works fine, on my Mac it works fine. But if I build to my iPad the black text shows on top of the white text.
I've even gone as far as putting a script in both where in the OnGUI() call I set their transform.position.z every update to try and force the black 'shadow' text to be behind the white text. The Z difference is only 1 unit, maybe that's not enough?
The black text is a child to the white text, basically so I can use a script to get the parent and copy the text.
Any other suggestions?
OnGUI and transform.position.z don't mix. OnGUI functions don't use transform.position, and GUIText objects don't use OnGUI.
Answer by JoshOClock · Jan 20, 2011 at 08:59 PM
In the end it turned out that I needed to remove the parent/child relationship. Once I did that I was able to set the Z in the transform.position to a different value and it directly effects the Z ordering.
Answer by Jessy · Jan 17, 2011 at 05:30 PM
Change the render queue of the white text to come after the black text.
Also, you can change both shaders to use ZTest Always, use Offset, or do a few other tricks to render them in the same plane, if you want to. There's no way to predictably batch these things, so you might as well do that, unless the 3D positioning helps you visualize.
Your answer
Follow this Question
Related Questions
Place GUI Text Under 2D Sprite 0 Answers
Sorting an Arraylist filled with structs. 2 Answers
Sort Array Of GameoObjects useing a variable 1 Answer
Particles not rendering on sorting layer specified with sprite-default shader 0 Answers
The best way to sort list of gameobjects in order I need? 0 Answers