unity script wait

Code Example - unity script wait

                
                        //The code above is WRONG and doesn't work at all ^^^
                    
                
 

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

Related code examples