-
Notifications
You must be signed in to change notification settings - Fork 2
IBehavior
jsutlive edited this page May 17, 2023
·
4 revisions
This interface is used for controlling objects that exhibit behaviors in the physics loop
Note all interface methods are considered to be public
| Return Type | Method Name | Description |
|---|---|---|
| void | awake | initialize variables (on object construction) |
| void | start | called once at the start of the simulation |
| void | update | perform tasks every physics loop iteration |
| void | lateUpdate | perform tasks every physics loop iteration, after all update tasks |
| void | earlyUpdate | perform tasks every physics loop iteration, before all update tasks |
| void | onDestroy | perform just prior to this object's removal |
| void | onValidate | called after an object is updated externally (e.g., GUI) or after initial creation |
This is described in more detail in the State Machine. The diagram below provides an overview of when these calls are made during program runtime. Calls are either made in the update loop (earlyUpdate, Update, lateUpdate) or outside the loop (awake, onValidate, and onDestroy). Calls outside the loop are often handled within the base class that implements IBehavior, while calls within the loop are managed by the program state/ update loop.