RUSTICDOCSSearch documentation

Lifecycle callbacks

Callbacks are entry points invoked by Rustic. Define only those a behavior needs.

When each callback runs

CallbackWhen to use itVariables
OnCreateOne-time construction before startup.None
StartResolve references and initialize gameplay state.None
OnEnableResume when the owner becomes enabled.None
FixedUpdatePhysics and simulation.dt: fixed-step seconds
UpdateInput and presentation.dt: frame seconds
OnDisablePause when the owner becomes disabled.None
OnDestroyRelease instance resources.None
OnStopFinal play-session cleanup.None

Examples in every language

These registration examples include every callback. Replace each body with the logic you need. Follow your language guide to generate the workspace, install its toolchain, attach the script and press Play. External dispatchers receive dt; it is meaningful for update and fixed_update. Physics runs after FixedUpdate, but collision callbacks use explicit Physics subscriptions, dispatched during Update after fixed-step resolution. Touchscreen callbacks and object clicks use Input subscriptions. HTML examples go inside an inline script in a ui/ HTML asset.

Lua 5.4

lua
return {
  OnCreate = function() end,
  Start = function() end,
  OnEnable = function() end,
  FixedUpdate = function(dt) end,
  Update = function(dt) end,
  OnDisable = function() end,
  OnDestroy = function() end,
  OnStop = function() end,
}