Hello,
I have a 2D sprite in the scene, and its child game object has a TextMeshPro-Text component (and a Mesh Renderer), I find the text always displayed behind the sprite, and there is no option of changing the sorting layer of the text. Please see the screenshot.
I need the text displayed over the sprite, and I can’t use UI Canvas and UI element because of the game feature.
Three (3) ways that Unity draws / stacks / sorts / layers / overlays stuff:
In short,
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.
Additional reading in the official docs:
And SortingGroups can also be extremely helpful in certain circumstances:
@karliss_coldwild Thanks for the tip, I’ve been searching for that option, I didn’t know I should expand the extra settings in order to show these options… @Kurt-Dekker Thanks for the info, although I found the option, but I still read these pages you shared, especially the sorting group. I remember you’ve answered my question before, really appreicate your attention.