Function

onUnuse

(action: (obj: GameObj, id: string) => void): KEventController

Register an event that runs when an object stops using a component.

param action- The function that runs when the event happens.

returns The event controller.

since v3001.1

group Events

Function

onUnuse

(tag: Tag, action: (obj: GameObj, compId: string) => void): KEventController

Register an event that runs when an object with the provided tag stops using a component.

param tag- The tag to match, only called for objects with a matching tag.

param action- The function that runs when the event happens.

// This will run when the tagged object removes a component.
onUnuse("ghost", (obj, compId) => {
    debug.log(obj, component);
});

returns The event controller.

since v2000.0

group Events

kaplay logo

Components

Miscellaneous