Say I have a script component that fires an event. Should I fire the event on the script component or the entity? Which is the standard approach in PlayCanvas?
Script component fires an event:
this.fire('load');
Users adds an event handler on the script component:
const scriptComponent = entity.script.create('myScriptComponent');
scriptComponent.once('load', function() {}, this);
Script component fires event on the entity:
this.entity.fire('my-script-component-load');
User adds an event handler on the entity:
entity.on('my-script-component-load', function() {}, this);