Answers for "have a command only run for a few seconds unity"

C#
0

have a command only run for a few seconds unity

StartCoroutine(GoLeft());
 IEnumerator GoLeft()
 {
     // This will wait 1 second like Invoke could do, remove this if you don't need it
     yield return new WaitForSeconds(1);
 
 
     float timePassed = 0;
     while (timePassed < 3)
     {
         // Code to go left here
         timePassed += Time.deltaTime;
 
         yield return null;
     }
 }
Posted by: Guest on January-21-2021

Code answers related to "have a command only run for a few seconds unity"

C# Answers by Framework

Browse Popular Code Answers by Language