There is one more subject to cover before we're finished with our exploration of tasks, and that is the task object itself. Every method we created as a task so far was set to accept a variable called task
. The task manager passes a task object into that variable.
Honestly, we don't need to interact with the task object very often. For the most part, it just supplies us with extra information about the task. We access that information by using the following attributes of the task
object:
task.time
returns a float that tells us how much time has passed since the first time the task was executed. This float continues to increase even when the task isn't being executed.task.frame
returns an integer that tells us how many frames have passed since the task was added to the task manager. This count may start from 0 or 1.task.id
returns a unique id number for the task. The task manager assigns this id number when the task is added.task.name
returns the name given to the task.Again, these aren't used very often, but they might help with debugging.