1
votes

I was using Unity in 3D mode than I had to change to HDRP:

rend.material.mainTextureOffset

and

rend.material.SetTextureOffset

were working normally but when upgraded to HDRP, they were not affecting the variables and not changing the scene so I thought they could have another parameter name or function.

To change the color of the material I had to change from: rend.material.SetColor("_Color", colors[0]); to rend.material.SetColor("_BaseColor", colors[0]);

1
It depends on what shaders you're using. Some shaders don't use texture offsets. You can see the supported properties if you look at the material in debug mode. docs.unity3d.com/Manual/InspectorOptions.html - artcorpse

1 Answers

2
votes

It worked by using the same function but changing the attribute name to _BaseColorMap

rend.material.SetTextureOffset(
  "_BaseColorMap",
  new Vector2(offset_x,offset_y));

and worked perfectly!