mainTextureOffset setTextureOffset with big value offset

hej guys, I have a little problem with setTextureOffset. when im using snippet

Vector2 uv = new Vector2(0, 1);

Vector2 uvOffset = Vector2.zero;

public void Update() {

    uvOffset += ( uv * Time.deltaTime );
    if( renderer.enabled ) {
        renderer.material.mainTextureOffset = uvOffset;
    }

}

everything is alright only at the begining. my texture scroll nice. but after quite time when uvOffset grow to high values texture has strange distortion. it’s getting strange artifacts.

how should I animate/scroll texture properly ? is it possible to assign only values in 0…1 range to animate values ?

best regards

I’ve been using Time.time to scroll textures the same way, but never had any unexpected result. Anyway, I think you can use the Mathf.Repeat function to limit the offset values:

  auvOffset = ( uv * Mathf.Repeat(Time.time,1) );

I had to change the logic a little, so auvOffset doesn’t accumulate offsets anymore - it receives the offset calculated on the fly from Time.time. It scrolls the texture at the same speed; the only difference is that your previous version always started from zero offset, while this one doesn’t.