I have a 2-d game that I am making, using 3-d assets, including TextMeshes for text. I have decided that in some instances, I would like to have the TextMesh appear behind objects in the foreground. The below is one such example.

enter image description here

It seems that the TextMesh is always in front. I have tried a number of things to get the text between the map and object layers, with no success. These include:

  • Moving the text between the map and object.
  • Changing the SortingLayers and SortingOrder. The map, objects, and labels are on 3 different layers, with the Objects being the highest layer, the map the lowest, and default and label in between.
  • Using a perspective camera, not orthographic.

Any ideas as to what else could be going on? Thanks!

How can I make the TextMesh appear that isn't on the top layer? Thanks!


2 Answers 2


In Text Mesh Pro, you can use overlay shader to render alway on top. enter image description here

And for normal rendering, you can use Distance Field Shader.enter image description here

Here is the demo.


The answer is fairly complex, and involves 2 key things. Note that I used this reference to help me.

  1. Create a custom text shader. There are two examples given, I chose this one, which is for one sided text, which I believe is more common.

    Shader "GUI/3D Text Shader - Cull Back" {
            _MainTex("Font Texture", 2D) = "white" {}
        _Color("Text Color", Color) = (1,1,1,1)
            Tags{ "Queue" = "Transparent" "IgnoreProjector" = "True" "RenderType" = "Transparent" }
            Lighting Off Cull Back ZWrite Off Fog{ Mode Off }
            Blend SrcAlpha OneMinusSrcAlpha
                ColorMaterial AmbientAndDiffuse
                    combine primary, texture * primary
  2. This shader should be applied to a material. The texture should be the texture of the font (Must download a font).

This allowed me to do this (Still working on what text to use exactly)

enter image description here

  • \$\begingroup\$ where to get a font texture? \$\endgroup\$
    – flankechen
    Jul 21, 2020 at 17:41
  • \$\begingroup\$ Just use TextMesh and TMP in world space only. Don't use it for canvas (not even TMP GUI which is supposed to work with canvas). The UI functionality of TextMesh and TMP remains very limited and buggy but they're great for simple texts in world space without canvas. \$\endgroup\$
    – Kristof
    Feb 19, 2021 at 9:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .