最近碰到Unity开启singlepass的时候,3D Text(Text Mesh)在Android设备上不显示。
可以通过使用自写的shader来解决此问题。
创建新materal和新shader,然后使Text Mesh使用此material和shader,则可在真机上显示成功。
附shader代码如下:
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
}
}
}
}