So far, all of our tasks have used the same return
statement, return task.cont
. This isn't our only option, though. In reality, we have three options to choose from:
task.cont
is our first option. Using this return value tells the task to execute again next frame. This option is intended for tasks that continue without interruption.task.again
is our second option. This option is meant for use withdoMethodLater
. If we use this return value, the task will execute again after the delay that's provided todoMethodLater
. This means that if we have a one second delay indoMethodLater
and we usereturn task.again
, the task will execute once every second.task.done
is the last return value. This tells the task to remove itself from the task manager and stop executing. We can usetask.done
with adoMethodLater
to perform an action once after a delay, or we could usetask.done
to stop a task that is no longer needed. Returningtask.done
is the same as returning nothing...