How does Material's "SetShaderPassEnabled" work?

I can’t seem to get “Material.SetShaderPassEnabled” to function the way I understand it to. I have a shader that looks like the following:

    Shader ".../ShaderName" {
        Properties { ... }
        SubShader {
            Tags { ... }
            Pass {
                Name "BACKSIDE"
                Cull Front
                
                CGPROGRAM
                // ... render back faces red
                ENDCG
            }
            Pass {
                Cull Back 
                CGPROGRAM
                // ... render front faces blue
                ENDCG
            }
    }

And in a script I have a material where I’m trying to toggle rendering the red backfaces on and off:

// ...
mat.SetShaderPassEnabled("BACKSIDE", false);
// ...
mat.SetShaderPassEnabled("BACKSIDE", true);

But it doesn’t seem to be doing anything. Am I using it right? Is my shader malformed? Or is there a bug with the function?

Thank you!

Edit: I’m using Unity 2017.1

Name Use Pass LightMode, not Pass Name :slight_smile: