onAdd(tag: Tag, action: (obj: GameObj)=>void): KEventController
Register an event that runs when an object with the provided tag is added.
param
tag- The tag to listen for.
param
action- The function that runs when an object is added.
// This will run when the object is added. onAdd("player", () => { debug.log("ohhi"); }); add([ pos(), "player" ]);
returns
The event controller.
since
v2000.0