Shader works in editor but not in Android - Pass 'meta' has no vertex shader
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
Answer by jiexue1998 · Feb 25, 2019 at 06:49 AM
I have the same problem, it stopped crashing after I disabled the "casting shadows" in the directional light. I'm not sure if this is the best solution...
Your answer
Follow this Question
Related Questions
Black screen on Android build 14 Answers
LWRP lowest android version 0 Answers
Grey/Dark line between two cubes 1 Answer
Custom Shader is Pink Only Samsung 2 Answers
Failed Re pack resources Unity Android 0 Answers