Skip to content

Behaviour

The Behaviour class represents a fundamental component within the scene graph system, serving as a container for properties and behaviors associated with nodes in the scene

Usage

This class is implicity included in every scripts, no require necessary.

Reference

getByNodeId

static getByNodeId(nodeId)

Get all behaviours attached to a specific node ID.

Parameters

  • nodeId (string): The ID of the scene graph node

Returns

  • table: table containing all behaviours attached to the node

getByNodeIdAndScriptName

static getByNodeIdAndScriptName(nodeId, scriptName)

Get a single behaviour attached to a node ID with a specific script name.

Parameters

  • nodeId (string): The ID of the scene graph node
  • scriptName (string): The script name of the behaviour

Returns

  • Behaviour|nil: behaviour if found, or nil

getNodeId

getNodeId()

Returns the node ID this Behaviour is attached to.

Returns

  • string|nil: ID of the attached scene object

getScriptName

getScriptName()

Returns the script name of this Behaviour.

Returns

  • string: name

getProperties

getProperties()

Returns a table of all properties defined on the behaviour class.

Returns

  • table: table with fields: name, defaultValue, type, order

isActive

isActive()

Returns the active state of the behaviour. If the owner item is inactive, so are all attached behaviours

Returns

  • boolean: if active, othersise false

isInitialized

isInitialized()

Returns the initialized state of the behaviour. If true, init ran through or there is no init

Returns

  • boolean: if initialized, othersise false

init

_init()

ondisable

_ondisable()

onenable

_onenable()

ondestroy

_ondestroy()

updateAll

static _updateAll(deltaTime, deltaTimeSmooth)

Parameters

  • deltaTime
  • deltaTimeSmooth

renderAll

static _renderAll()

renderguiAll

static _renderguiAll()

setActive

static _setActive(nodes)

Parameters

  • nodes

debugStats

static _debugStats()