I want to wait .01 second for every iteration of a for loop, but I can't figure out why.
heres the plain code with no wait.
public void BlackOut()
{
for (int i = 1; 1<255; i++)
{
Color tmp = gameObject.GetComponent<SpriteRenderer>().color;
tmp.a = i;
gameObject.GetComponent<SpriteRenderer>().color = tmp;
//Wait here
}
}
I want to add the wait at the at the comment but everything I tried doesn't work
In lua it is :
for i = 1,255 do
--change color depending on engine
wait(.01)
end
I tried wait for seconds, task.delay, ect..