coming from unity i would create pool of prefab to avoid instantiting, and i was wondering is there any pools manager available for playcanvas
i need to acces cotroller on the template.
sorry of this is newbie question
coming from unity i would create pool of prefab to avoid instantiting, and i was wondering is there any pools manager available for playcanvas
i need to acces cotroller on the template.
sorry of this is newbie question
Hi @mirkoni,
I am afraid there is no generic pool manager available in the Playcanvas store or Playcanvas tutorials at the moment, so you would have to write one yourself.
ok i get it, do you know easiest way to get script on template? if it’s instantiated like this
var templateAsset = this.app.assets.get(templateAssetId);
var instance = templateAsset.resource.instantiate();
this.app.root.addChild(instance);
You can get the script reference, by doing:
let scriptInstance = instance.script.scriptName;
// then call a function from that script
scriptInstance.someFunction();
The scriptName is present at the top of every script:
If you want to add script at run time, see