Hello and thank you for checking out my question. I’m using a IEnumerator function but for some reason it won’t wait the few seconds I need it to and just executes.
public float duration = 5f;
public Texture[] textures;
private void OnMouseDown()
{
StartCoroutine(Blonk());
}
public IEnumerator Blonk()
{
int i = 0;
while (i < textures.Length)
{
GetComponent<Renderer>().material.mainTexture = textures*;*
i++;
yield return new WaitForSeconds(duration);
}
}
I’m new to IEnumerators so I’m not sure if I’m even using it correctly. Any insight would appreciated. Thank you!