I’ve read that this is possible, but I haven’t been able to figure out how to do it. Can someone explain to me how this works?
Have you read the docs? Unity - Scripting API: Material.Material
There’s a constructor where you pass in the shader that should be used by the material. e.g.
Material mat = new Material(Shader.Find("Specular"));