Unity 3D and Desaturation Shader

So this piece of code is for a custom desaturation shader you can use in Unity to desaturate (greyscale) any texture by changing the shader, which you can do either manually of via code.

Shader "Custom/Desaturate" {
     Properties  {
         _MainTex ("Texture", 2D) = ""
     SubShader {
         Blend SrcAlpha OneMinusSrcAlpha
         Pass {
              Color(.389, .1465, .4645, 0.5)
              SetTexture[_MainTex] {Combine one - texture * primary alpha, texture alpha}
              SetTexture[_] {Combine previous Dot3 primary}

Just right click on your project view and create a new Shader and put this code in there. Save it with any name you’d like. The share will now appear under the “Custom” list when selecting a shader for your material. To assing it via code, you would do this:

referenceToMyObject.renderer.material.shader = Shader.Find("Custom/Desaturate");

Very simple!

Moving notice:
Minor edits to post.