Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

how to wait for a few seconds unity

// This is a new function.
IEnumerator WaitForSeconds(float time){
	shouldWalk = false;
	yield return new WaitForSeconds(time);
	shouldWalk = true;
}
Start(){
  	Debug.Log("Hi");
	WaitForSeconds(10);
    Debug.Log("Bye.");
  	//Here, We are printing Hi to the console, wait 10 seconds, and then print bye to the console.
  	
}
 
PREVIOUS NEXT
Tagged: #wait #seconds #unity
ADD COMMENT
Topic
Name
5+8 =