Hi
I want to use textmeshpro rather than the UI text objects as it feels cleaner and i don’t need to worry about canvasses etc
So I have squashed a cube down to act as my panel and then am positioning text objects over it - see attached
When I look at the objects in the editor they are hanging all over the place and i need to bring far forward in order for them to come in front of the cube object.
Sorry not to explain this well but hopefully the attached images will help explain
How do i fix this so what I see in the editor is what I see when i run the app?
Um… by doing it the normal way? In this case probably with a Canvas, Render Mode set to World Space.
As for the draw order…
Three (3) primary ways that Unity draws / stacks / sorts / layers / overlays stuff:
In short, as far as the Standard Rendering Pipeline,
The default 3D Renderers draw stuff according to Z depth - distance from camera.
SpriteRenderers draw according to their Sorting Layer and Sorting Depth properties
UI Canvas Renderers draw in linear transform sequence, like a stack of papers
If you find that you need to mix and match items using these different ways of rendering, and have them appear in ways they are not initially designed for, you need to:
identify what you are using
search online for the combination of things you are doing and how to to achieve what you want.
There may be more than one solution to try.
For instance, you may even use multiple co-located cameras to more-explicitly control apparent draw ordering.
Additional reading in the official docs:
And SortingGroups can also be extremely helpful in certain circumstances:
Other rendering pipelines may have other ways of layering (HDRP and URP). Go see the latest docs for details.
the same thing happens with canvas - but will look at those links… thanks
you will be delighted to know that GPT is answering more and more of these questions so soon you won’t have worry about this idiot questions at all
TextMeshPro is an odd one. it has both Z-sorting, of a sort, and Sorting Group responses, of a sort. Unfold the second part of the Inspector for (Extras) in the TextMeshPro settings, to see Sorting Group and set it. It still somewhat responds to Z, though. So it can be a bit of a muddle.