Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

unity wait for seconds

void start() => StartCoroutine(MyIEnumerator());

IEnumerator MyIEnumerator()
{
	Debug.Log("Hello world!");
    yield return new WaitForSeconds(3);
    Debug.Log("Goodbye world!");
}
Comment

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")
    }
Comment

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.
  	
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: unity why is there no transform.left 
Csharp :: c# convert Unix time in seconds to datetime 
Csharp :: unity get speed of object 
Csharp :: c# set a guid 
Csharp :: unity reload current scene 
Csharp :: exit application wpf 
Csharp :: Csharp cast string to double 
Csharp :: c# remove all null from list 
Csharp :: unity add explosion force 
Csharp :: button color uwp c# 
Csharp :: c# read json file into object 
Csharp :: unity spawn object at position 
Csharp :: c# print out 
Csharp :: get random number c# 
Csharp :: asp.net list all files in folder 
Csharp :: compute months c# 
Csharp :: c# counting lines 
Csharp :: delay in unity 
Csharp :: message box in visual studio 
Csharp :: get type of exception c# 
Csharp :: sum of two numbers in c# 
Csharp :: dyncmics 365 setstate request 
Csharp :: .net loop through dictionary 
Csharp :: add tablelayoutpanel dynamicly to winform in c# 
Csharp :: make mesh follow wheel collider unity 
Csharp :: how to change scenes in unity 
Csharp :: c# md5 hash file 
Csharp :: loan calculator using windows forms in c# code 
Csharp :: Create gaps / headers between variables in the unity inspector 
Csharp :: unity agent bake not derecting mesh 
ADD CONTENT
Topic
Content
Source link
Name
8+2 =