Answers for "how to make a loop in unity"

C#
4

for loop unity

for (int i = 0; i < 50; i++)
{
	//Do something 50 times
}
Posted by: Guest on June-17-2020
1

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();
}
Posted by: Guest on January-06-2021

Code answers related to "how to make a loop in unity"

C# Answers by Framework

Browse Popular Code Answers by Language