Shader working in Editor but not in build?

Hi, I have a simple shader from the internet which works good in the editor (Unity 2017), but not really in a build. It is a simple dissolve shader:

Shader "Custom/Dissolve" {
    Properties{
        _Color("Color", Color) = (1,1,1)
    _SliceGuide("Slice Guide (RGB)", 2D) = "white" {}
    _SliceAmount("Slice Amount", Range(0.0, 1.0)) = 0.5
    }
        SubShader{
        Tags{ "RenderType" = "Opaque" }
        Cull Off
        CGPROGRAM

#pragma surface surf Lambert addshadow
        struct Input {
        float2 uv_MainTex;
        float2 uv_SliceGuide;
        float _SliceAmount;
    };
    float4 _Color;
    sampler2D _SliceGuide;
    float _SliceAmount;
    void surf(Input IN, inout SurfaceOutput o) {
        clip(tex2D(_SliceGuide, IN.uv_SliceGuide).rgb - _SliceAmount);
        o.Albedo = _Color;
    }
    ENDCG
    }
        Fallback "Diffuse"
}

I run it from my code like this (I dont think this is the problem, it runs fine in the editor and the debug log is perfect in the build):

     IEnumerator BlinkCo()
    {
        Blinking = true;
        rising = true;
        ChangeShader(BlinkingShader); // the dissolve shader
        yield return new WaitForSeconds(sc.Stats.BlinkDuration / 2);
        ChangePos();
        rising = false;
        yield return new WaitForSeconds(sc.Stats.BlinkDuration / 2);
        ChangeShader(NormalShader); // the standard shader
        Blinking = false;
        currentDissolve = 0;
    }

private void Update()
    {
        if (Blinking)
        {
            ChangeDissolve(rising ? Time.deltaTime * 15 : -Time.deltaTime * 15);
        }
    }

string prop = "_SliceAmount";
    private void ChangeDissolve(float delta)
    {
        currentDissolve += delta;
        currentDissolve = currentDissolve < 0 ? 0 : currentDissolve;
        currentDissolve = currentDissolve > 1 ? 1 : currentDissolve;
        for (int i = 0; i < meshes.Length; i++)
        {
            for (int j = 0; j < meshes[i].materials.Length; j++)
            {
                meshes[i].materials[j].SetFloat(prop, currentDissolve);
                Debug.Log(meshes[i].materials[j].GetFloat(prop));
            }
        }
    }

   void ChangeShader(Shader shad)
    {
        for (int i = 0; i < meshes.Length; i++)
        {
            for (int j = 0; j < meshes[i].materials.Length; j++)
            {
                meshes[i].materials[j].shader = shad;
            }
        }
    }
 
    }

In the editor, the shader changes when you blink, it dissolves, you change position and it fades in again. But in a windows build I can only see the shaders switch, but there is no dissolve. I added the shader to resources and also into the “always include shader” in the graphic options. What is wrong with the shader, that it only runs correctly in the editor? Thanks for your help, much appreciated! (The debug log shows the correct values in the build, but it doesnt dissolve)

I think the problem is here:

clip(tex2D(_SliceGuide, IN.uv_SliceGuide).rgb - _SliceAmount);

Try to use a float instead of a float3, e.g.

clip(tex2D(_SliceGuide, IN.uv_SliceGuide).r - _SliceAmount);

Oh, and btw. you can also use a global shader value instead of setting the dissolveAmount in very shader. Take a look at Unity - Scripting API: Shader.SetGlobalFloat

Thanks, I was happy that you found an error, but it still didnt work. The shader isnt purple in the build but no dissolve at all, it looks like a normal surface shader. (even without the fallback)

Thanks for the tipp with setglobalfloat but I dont think I can use it, because many gameObjects will use the shader and I dont want to change values on all of them.

Edit: on it, it might be my code

Edit: Case closed.

In the editor, the SliceGuide texture was automatically assigned. In build it was null.

    void ChangeShader(Shader shad)
    {
        for (int i = 0; i < meshes.Length; i++)
        {
            for (int j = 0; j < meshes[i].materials.Length; j++)
            {
                meshes[i].materials[j].shader = shad;
                if (shad == BlinkingShader)
                    meshes[i].materials[j].SetTexture("_SliceGuide", SliceGuide);
            }
        }
    }