Material texture animation on single item

EDIT solved use material not shared material

Hi All,
I have s script that scrolls a texture UV on a material ( using
rend.sharedMaterial.mainTextureOffset ). Works great. Well at least I thought it did, however if I have multiple objects with the same material all the objects animate at the same point. EG id I start animation on 1 object and scroll 5 pixels, I then start the animation on object 2 with the same material, object ones animation jumps back to point 0 in it’s animation.

I’ve worked out this is because of the it’s changing the UV on the master material
, is there anyway I can make it scroll without reset. The only way I can think of at present is to make multiple copies of a material, which I know is stupid. Is there any other way around this?

If you use
rend.material.mainTextureOffset
Unity will automaticly genererate a new material instance and only change that one
so all other object that use the material will not be affected

1 Like