Skip to content

repl-games/Unity-DoAfter-CSharp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Simple Timer Unity Coroutine

Some examples of how to use DoAfter():

// Execute the EndGame() method after a 5 second delay
StartCoroutine(DoAfter(5f, ()=>EndGame()));

// Wait 1 second and instantiate a gameObject
StartCoroutine(DoAfter(1f, ()=>Instantiate(itemDropObject, itemPosition, Quaternion.identity)));

// Prevent game audio from repeating infinitely
StartCoroutine(DoAfter(0.2f, ()=>attackAudioCooldown = false));

About

🌀 A cooldown IEnumerator that can delay actions in Unity

Topics

Resources

License

Stars

Watchers

Forks

Languages