I am trying to make a texture tile through a script based on my object’s scale, in Unity 2018.30f2 it works great but the same code does nothing in Unity 2019.2 using the LWRP.
As mentioned the code below works in Unity 2018.30f2 but not in Unity 2019.2 using the LWRP.
According to the documentation, this is the way to do it?
cube.GetComponent<Renderer>().material.mainTextureScale = new Vector2( 1.5f, 1.5f);
I fixed this issue by calling “_BaseMap” as the string name of the texture instead of “_MainTex”.
Code looks like this:
Code (CSharp):
rend.material.SetTextureScale("_BaseMap", new Vector2(5,5));