For my mobile game, I am using this general shader to replace Unity’s standard and Mobile/Diffuse shader (credits):
Shader "Mobile/DiffuseX"
{
Properties
{
_Color("Color",COLOR)=(0.5,0.5,0.5,1.0)
_MainTex ("Base (RGB)", 2D) = "white" {}
}
SubShader
{
Tags { "RenderType"="Opaque" }
LOD 150
CGPROGRAM
#pragma surface surf Lambert noforwardadd
sampler2D _MainTex;
fixed4 _Color;
struct Input
{
float2 uv_MainTex;
};
void surf (Input IN, inout SurfaceOutput o)
{
fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
o.Albedo = c.rgb;
//o.Alpha = c.a;
}
ENDCG
}
Fallback "Mobile/VertexLit"
}
It’s working perfectly fine in the Editor (when build platform is set to Android). However, when running on Android, I get the following error:
WARNING: Shader
Unsupported: 'Mobile/DiffuseX' - Pass 'Meta' has no vertex shader
I have done a lot of research about this, but I can’t find any solutions. I have tried the following things:
- Adding the shader to “Always Included Shaders”
- Disabling shader support for “Depth Normals” and “Motion Vectors” under “Built-in Shader Settings”
- Turning off “Auto Graphics API” and using just OpenGLES 2.
- Commenting “o.Alpha = c.a”
Nothing works. Is this a bug within Unity or an error on my part? Any thoughts about a fix/workaround?
Dev environment: Unity 2018.3.0f2, Windows 10, Android build
Testing phone: Moto G5 Plus, OpenGL ES 3.2, Adreno 506, Android 8.1.0