IBehaviorInstance script interface

The IBehaviorInstance interface represents a behavior on an IInstance.

Many behaviors return a more specific class deriving from IBehaviorInstance to add APIs specific to the behavior. See the Behavior instances reference for more information.

IBehaviorInstance APIs

addEventListener(type, func, capture)
removeEventListener(type, func, capture)
Add or remove an event handler for a particular type of event fired by an addon's script interface. For information on which events are fired by specific addons, see the documentation on each addon's script interfaces.
dispatchEvent(e)
Dispatch an event, firing any handler functions that have been added for the event type. You can use new C3.Event(eventName, isCancellable) to create an event object that can be dispatched (e.g. new C3.Event("arrived", true)), and add any extra properties relevant to your event to that object. This can also be used by the addon SDK to cause your addon to fire an event in the script interface, e.g.:

const e = new C3.Event("arrived", true);
this.GetScriptInterface().dispatchEvent(e);

instance
A reference to the IInstance representing the object instance this behavior instance is affecting.
behavior
A reference to the IBehavior representing the kind of behavior, e.g. Solid or Physics.
runtime
A reference back to the IRuntime interface.
Construct 3 Manual 2020-09-02

On this page