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

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

paramaction- The function that runs when the event happens.

returnsThe event controller.

sincev3001.1

groupEvents

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

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

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

paramaction- The function that runs when the event happens.

// This will run when the tagged object uses a new component.
onUse("taggedObjTag", (obj, compId) => {
    debug.log(obj, component);
});

returnsThe event controller.

sincev2000.0

groupEvents