I’ve had a search around and can’t find anything on this, but apologies if it’s been covered before.
Is it possible to have a script
type for ScriptAttributes args.type
? Something like:
MyScript.attributes.add('entityWithScript', {
type: 'script',
scriptType: 'otherScript'
});
Where otherScript
would be an existing registered script name.
This would let developers reference an entity that has a certain script, instead of just an entity which may or may not have a required script (via the entity
type), making scripts more reusable between entities by becoming more generic.
// Can be called knowing this.entityWithScript will have `otherScript`
this.entityWithScript.script.otherScript.doSomething()
Maybe the this.entityWithScript
reference could be shorthand for reaching into the other entities script.otherScript
component.
This could perhaps go for the asset
type too, where the attribute requires a template that has a certain script attached.