TextMesh Always Behind Background... Can Only See Orange Outline

I’m trying to make damage numbers appear over enemies but the TextMesh is always stuck behind everything else. There’s no options to change sorting layers and using TextMeshPro is doing the same thing, even when I change shaders. It’s worked when I used Unity a year ago though with TextMesh.

Any idea what’s going on? Thanks!
Edit: Attaching the screenshot of the problem that I posted below.

2D or 3D? Also a screenshot can really help understand what’s going on.

2D. And I’m on it, attached the screenshot

8516744--1135385--Screenshot (15).jpg

Try setting the Transform Z value to 0?

I’ve tried that and just tried it again, it doesn’t change anything

Show the Canvas parameters?

Sure, the first image is the Canvas inspect and the second one is one of my parallax backgrounds inspect
8516834--1135394--Screenshot (16).jpg 8516834--1135397--Screenshot (19).jpg

Am I missing something or your Text GameObject is not inside the Canvas as it should?

Oh, I thought that was weird but the tutorial I’m watching didn’t have it in there. Anyways, I added it and still nothing
8516858--1135400--Screenshot (20).jpg

I don’t think TextMesh requires a canvas.

TextMeshPro does use the canvas however, but they have a version that doesn’t require it under the 3D object list.

Normally Sprites are layered based on the Z axis, so I would assume this is the same for TextMesh.

Is the background image a sprite or a UI image?

8516879--1135406--upload_2022-10-15_20-26-20.png

So here I have a black sprite. The “Hello World” is a text mesh object.
The Sample Text is a TextMeshPro (non-ui) object.
The black sprite is on z = 0 and the two text objects are at z = 1, putting them behind the sprite.

If I put the text at z <= 0, they show in front of the sprite.

It’s a parallax background made up of multiple layers of sprite images. There are background sprites with -10 on the Z axis. But even if I go to anywhere from 0 to -11 on the Z axis for my TextMesh, it doesn’t show above the background.
My TextMesh inspect and Camera inspect:
8516894--1135415--Screenshot (23).jpg 8516894--1135418--Screenshot (24).jpg

What is the z setting for the background? Or the layers that make it up. Not just the camera.

You’ll need to look at all the layers that make up the background and make maybe play with the z setting for the piece that currently overlaps your text.

All of the layers are duplicates of each other so all of the individual layers have a 0 Z axis and the group layer says 10 Z axis for whatever reason. If I change it then they disappear in game view. So as I understand, they shouldn’t be covering my TextMesh if it’s below 0. Even if I put the TextMesh Z to -150 as a test it’s still showing behind the background
8516954--1135439--Screenshot (25).jpg 8516954--1135442--Screenshot (26).jpg

At this point what I would do is just off to the side, start recreating your layering. First just add a sprite and a textmesh object. See if changing the z value changes the order that they render.
This would be the most basic setup. If the layers switch when you change the z value, then you know it’s working and there is another setting that is keeping it from working correctly.
Once the text is in front of this sprite, start making the other changes. Add in the parents, change each setting one at a time. Does anything suddenly make the text be behind the sprite.

Is it the sorting layer? Layer mask? Etc. I think doing this will be the best approach as I’m simply trying to work through your hierarchy to figure things out and I think it’s just easier for you to be able to go through things.

That helped, if I put everything on the default layer with a -value sorting layer, the textmesh would appear in front of it. Instead of moving like 100 things to the default layer with a -sorting value, I wrote a script that moved the TextMesh to the top layer. Now it’s working
Thanks!

1 Like