- Home /
Question by
Derik-Stavast · Aug 15, 2019 at 01:43 PM ·
materialtexturestiling
Texture Tiling broken in Unity 2019.2 LWRP
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);
Comment
Best Answer
Answer by Derik-Stavast · Aug 18, 2019 at 09:34 PM
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));