So I'm having an issue that sounds like it should be relatively easy to fix, and it might be and I'm just going about this all wrong. My Game uses the Sorting Layer elements on all of my sprites, so that they don't get hidden behind others.
I'm trying to create a TextMeshPro UI object (just simple text) but because of these sorting layers I have setup, it is always behind the other sprites. I want the text to be in front of all the sprites. I've tried setting up a script to do this, but I'm not completely sure where to point this script. Most answers say to a Mesh Renderer, but that does not seem to work for me.
Any suggestions are appreciated, thanks!
Edit: The text is grouped with another sprite in the hierarchy
Edit 2: By request of Darkonekt I'll try to add a some more explanation.
Steps I have found to replicate:
- After creating a new project (2D), dd the TMPro asset (I did this by adding a Text Mesh Pro UI object to the scene and importing just the essentials.)
- Put any form of sprite in the scene (make sure it is a child to the canvas)
- Add the Text Mesh Pro UI -Text Object, make sure it is a child to the canvas
- Set the Canvas's render mode to "Screen Space - Camera" and set the render camera to the Main Camera
- You might need to re-size the sprite, make sure it takes up most of the screen
- Back on the sprite, in the Sprite Renderer Component, click sorting layer then add sorting layer
- Name it whatever you want, and make sure it is below Default
- On the sprite again, set thew Sorting Layer to Front, the text should have disappeared behind it.
There isn't any code to show, because none of the listed values above are not changed by any code.