i would guess that the issue is that you care creating the instance but your not telling the mesh to use it. basically your creating a material but not applying it to the mesh. in any case you will need to reference the mesh that your looking to change the material on.