Scriptcomponent

ScriptComponent class

Signature:

export declare class ScriptComponent extends ScriptHost 

Extends: ScriptHost

Properties

Property

Modifiers

Type

Description

config

static

readonly

ComponentOptions

geometry

never

instances

static

readonly

ScriptComponent[]

material

never

Methods

Method

Modifiers

Description

create(this, data)

static

Creates a new instance of the script component

getInstances(this)

static

getMain(this)

static

handleCollisionEnter(event)

Handles the collision enter event for the host component

handleCollisionExit(event)

Handles the collision exit event for the host component

handleCollisionStay(event)

Handles the collision stay event for the host component

handleSensorEnter(event)

Handles the sensor enter event for the host component

handleSensorExit(event)

Handles the sensor exit event for the host component

handleSensorStay(event)

Handles the sensor stay event for the host component

onDispose()

Invoked when the game is about to be destroyed. Use this for final cleanup, like releasing resources or unsubscribing from events

onEditorGetMeshes()

Returns the meshes that can be selected in the editor

onEditorMeshClicked(mesh, intersect)

Invoked when the user clicks on a mesh in the editor

onEditorMeshMouseEnter(mesh, intersect)

Invoked when the user hovers over a mesh in the editor

onEditorMeshMouseLeave(mesh)

Invoked when the user hovers out of a mesh in the editor

onEnd()

Invoked whenever the game has ended.

onFixedUpdate(dt)

Invoked at regular intervals when the game is running. Use this when writing custom controls, or other physics sensitive calculations.

onFrame()

Invoked each frame even if the game isnt running

onGetCollisionMesh()

Invoked when the host component is asked for its collision mesh (if any)

onLoad()

onPause()

Invoked when the game is paused by the user.

onPreload()

onReady()

Invoked only **one time** when all assets are loaded and the game is ready to start.

onRenderDispose()

Invoked when the host component is asked for its collision mesh (if any)

onRenderInit()

Invoked when the host component is initialized

onRenderUpdate(opts)

Invoked when the host component is updated

onResume()

Invoked when the game is resumed by the user.

onStart()

Invoked whenever the game is started or restarted by the user.

onUpdate(dt)

Invoked each frame when the game is running.