Search Unity

  1. Unity 2019.1 is now released.
    Dismiss Notice

Shader works in editor but not Android - Pass 'meta' has no vertex shader

Discussion in 'Shaders' started by hsirkar, Jan 20, 2019.

  1. hsirkar

    hsirkar

    Joined:
    Jan 29, 2017
    Posts:
    1
    I did not know where exactly to post this, so hopefully this is the right place.

    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:

    1. Adding the shader to "Always Included Shaders"
    2. Disabling shader support for "Depth Normals" and "Motion Vectors" under "Built-in Shader Settings"
    3. Turning off "Auto Graphics API" and using just OpenGLES 2.
    4. 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