How to wait for seconds using enums | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to wait for seconds using enums

just say ienumerator void (function name ) and within curly braces write the yield new waitforseconds and in parenthesis how many seconds you want to wait just close it and in start or update method write startcorotene nd within parenthesis the name of the method and you are good to go

26th Jun 2018, 1:42 PM
kashyap chodankar
kashyap chodankar - avatar
1 Answer
To wait for a specific duration of time using enums in Unity, you can use the IEnumerator coroutine. By defining a coroutine function that includes a "yield return new WaitForSeconds()" statement, you can pause the execution for the desired time. Simply call this coroutine function using StartCoroutine() in either the Start or Update method. This way, your script will execute in a more organized manner, allowing for pauses and smooth transitions in your game logic.
14th Apr 2024, 6:15 AM
`нттየ⁴⁰⁶ - avatar