Hi, Im trying to loop through a list of textures and make an animation based on that.
But after the first “delay” the textures start to flikker.
I have tried to do some debugging, and it seems it just put the images ontop of eachother or reapeating them really fast without the delay.
Any ideas ?
public static List ContentList
public IEnumerator ChangeTextures(Renderer renderer, List<Texture> textures, float delay,bool Play )
{
int i = 0;
while (Play)
{
renderer.material.mainTexture = textures*;*
i = (i+1)%textures.Count;
yield return new WaitForSeconds(delay);
}
}
private void StartContent()
{
//Other stuff
StartCoroutine(ChangeTextures(this.gameObject.renderer, ContentList, 5f,PlayContent));
}
public void Play()
{
StartContent();
EnablePause = false;
PlayContent = true;
this.gameObject.renderer.enabled = true;
}