Answers for "how to make wait time code unity"

C#
3

how to make a method wait in unity

public float timeLeft = 30.0f

void Update()
{
  timeLeft -= Time.deltaTime;
            if (timeLeft < 0)
            {
            //Do your method here
            }
}
Posted by: Guest on February-22-2021
1

wait in unity

IEnumerator wait(float waitTime){ //creating a function
        yield return new WaitForSeconds(waitTime); //tell unity to wait!!
    }
    
    void Start(){
    	print("start");
        wait(1); ///using function
        print("Good night")
    }
Posted by: Guest on June-07-2021

C# Answers by Framework

Browse Popular Code Answers by Language