Change the Smoothness Source of a Material in a script?

I would like to change the Smoothness Source of a material from Metallic Alpha to Albedo Alpha in a script. I can set the Metallic and Smoothness values using SetFloat(“_Metallic”, floatValue) and SetFloat(“_Glossiness”, floatValue) but I can’t find a way to change the source. I am guessing it is something like EnableKeyword(“_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A”) but this doesn’t seem to work, or I am using the wrong keyword. Any help or suggestions are greatly appreciated.

After looking at the Standard Shader source, and trying a few combinations, I found that this appears to work:

Material material = theObject.GetComponent<Renderer>().sharedMaterial;
material.SetInt("_SmoothnessTextureChannel", 1);
material.SetFloat("_Metallic", 0.27f);
material.SetFloat("_GlossMapScale", 0.93f);
//material.SetFloat("_Glossiness", 0.93f);

To switch to the Metallic Alpha channel set the integer to 0 and swap the _GlossMapScale and _Glossiness lines.

@MediaGiant Thank you very much for the answer. The method you stated perfectly solved my problem. I just referenced a material and used only 1 line from your code " material.SetFloat(“_Metallic”, 0.27f); "