for loop unity c code example

Example 1: for loop unity

for (int i = 0; i < 50; i++)
{
	//Do something 50 times
}

Example 2: how to make a loop in unity

public bool one = true;
public bool two = false;
public float delay = 2f;

void Update()
{
  if(one == true)               // the delay at the top is the amount
  {                             // of seconds until you call the Function
    Invoke("One", delay);       // again so if the delay were 3f it
    one = false;                // whould be three seconds until you call
  }                             // the Function again
  if(two == true)
  {
    Invoke("Two", delay);
    two = false;
  }
}
void One()
{
  two = true;                   // where it says "FunctionName" is the name
  FunctionName();               // of the function you want to be called
}                               // for example if your function is called
void Two()                      // "void Move()" then it whould be "Move"
{                               // instead
  one = true;
  FunctionName();
}