iPhone uv animation munging textures?

Heyaz,

I thought I saw something about this somewhere but I couldnt find with the search. I am animating uvs to scroll a texture in one direction. After about 10-20 mins (ill have to time it exactly) the texture seems to corrupt itself or get munged while running on the iPhone hardware. Anyone know a work around for this?

Here are two .png’s attached that show my issue and the script.

var scrollSpeed :float  = 0.5;
var u : boolean = false;
var v : boolean = false;

function Update () {
	var offset : float = Time.time * scrollSpeed;
	if (u == true  v == true)
	{
		renderer.material.SetTextureOffset ("_MainTex", Vector2(offset,offset));
	} 
	else if (u == true) 
	{
		renderer.material.SetTextureOffset ("_MainTex", Vector2(offset,0));
	}
	else if (v == true) 
	{
		renderer.material.SetTextureOffset ("_MainTex", Vector2(0,offset));
	}


}

122551--4606--$img_0045_104.png
122551--4607--$img_0044_421.png

The UV precision will degrade after a certain amount of time when you keep offsetting it by a larger and larger number. Instead try looping through a smaller offset amount.

Ethan

Maybe something like “var offset : float = Time.time * scrollSpeed % 1;”

–Eric

Ethan: Makes sense. Cool!

Eric5h5: Thanks tons! :slight_smile:

Its all good now ^_^.