unity-game-enginetexture-mapping

Scaling the Metallic texture in the standard shader in Unity


I'm trying to change the tilling of the metallic texture in the standard shader at run time. In the process of testing the operative piece of code has ended up looking like this:

mr.material.SetTextureScale("_MetallicGlossMap", new Vector2(Random.Range(0f, 100f),Random.Range(0f,100f)));

This produces no errors but does nothing at all.

I'm at a loss.


Solution

  • I've found the answer to this.

    The texture scale of the metallic map is controlled by _MainTex. Material.SetTextureScale("_MainTex", scale) will set the metallic map scale as well. However, Material.MainTextureScale will not.

    Not at all confusing.