最近碰到Unity开启singlepass的时候,3D Text(Text Mesh)在Android设备上不显示。

可以通过使用自写的shader来解决此问题。

创建新materal和新shader,然后使Text Mesh使用此material和shader,则可在真机上显示成功。

Unity Text Mesh在Singlepass下不显示问题

附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
			}
		}
	}
}

 

相关文章:

  • 2021-10-14
  • 2021-09-01
  • 2021-07-14
  • 2022-01-02
  • 2021-05-11
  • 2021-09-06
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-07-19
  • 2021-04-23
  • 2022-01-02
  • 2022-12-23
  • 2021-07-15
  • 2021-08-15
  • 2022-12-23
相关资源
相似解决方案