Skip to content

Latest commit

 

History

History
14 lines (10 loc) · 444 Bytes

README.md

File metadata and controls

14 lines (10 loc) · 444 Bytes

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));