I am animating the uv coords on the uvRect of a RawImage by code to “slide” a texture from left to right.
This works nice so far, but if the x coord exceeds 0.25 it jumps to -0.5 and when it gets lower than -0.5 it jumps to 0.25.
void Update()
{
//
float deltaAngle= FPController.me.transform.eulerAngles.y-angleLastFrame;
angleLastFrame = FPController.me.transform.eulerAngles.y;
Rect r = rawImg.uvRect;
r.x += deltaAngle * uvPerAngle;
rawImg.uvRect = r;
//if (r.x < 0f) r.x+= 1f;
//if (r.x > 0.2f) r.x-= 1f;
//r.x += 1f;
}
Any ideas?