Template pools how to?

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();

You can get the script reference, by doing:

let scriptInstance = instance.script.scriptName; 
// then call a function from that script

The scriptName is present at the top of every script:
Screenshot 2022-02-14 184735

If you want to add script at run time, see