- Home /
Make something delayed in a non-coroutine function and have it only happen once?
I want something like
(if spacebar is up, currentenergy is less than maxenergy and currenthealth is greater than maxhealth divided by 2) { wait 1 second start regenerating and dont pause again }
Comment
Answer by Trungdv · Dec 09, 2014 at 01:56 AM
How about this? http://docs.unity3d.com/ScriptReference/MonoBehaviour.Invoke.html
However, I prefers coroutine than invoke. Because when gameobject is disabled, the coroutine will be canceled, but the invoke call will not.