Answer the question
In order to leave comments, you need to log in
How to make a Text mesh not show through other objects?
In general, I create a Text mesh, place it where necessary on the stage, everything is fine, but this text is visible through the objects behind which it is located, I need it to be displayed as ordinary meshes, i.e. not visible if it is obscured by another mesh
Answer the question
In order to leave comments, you need to log in
The shader taken from here helped me, there is also an instruction on how to set everything up.
wiki.unity3d.com/index.php?title=3DText
I used standard fonts from unity.
It is strange that I could only find it by chance when I was looking for something completely different.
Shader "GUI/3D Text Shader" {
Properties {
_MainTex ("Font Texture", 2D) = "white" {}
_Color ("Text Color", Color) = (1,1,1,1)
}
SubShader {
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
Lighting Off Cull Off ZWrite Off Fog { Mode Off }
Blend SrcAlpha OneMinusSrcAlpha
Pass {
Color [_Color]
SetTexture [_MainTex] {
combine primary, texture * primary
}
}
}
}
Perhaps a problem with the SortingLayer? Although it may not be visible on the TextMesh script itself, it still affects the stacking order.
This has been discussed here: answers.unity3d.com/questions/595634/3d-textmesh-n...
Here is the script I used to look at all SortingLayer objects:
https://gist.github.com/nickgravelyn/7460288
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question