Instantiating A Template

Hi, I’m having trouble instantiating a template. For instantiating resources straight from the assets in the past I have used the following code, but this does not seem to work for templates.
This works…

 var templateAsset = this.app.assets.get(128235719);//Some direct UID to a resource
 var instance = templateAsset.resource.instantiate();

However when I try this for a template it doesn’t work:

var templateAsset = this.template_variations[0]; //an array of templates defined in the editor
var instance = templateAsset.resource.instantiate();

I get an error - undefined (reading ‘instantiate’)

What am I doing wrong?

Hi @Grimmy,

How/where are you defining the following array?

this.template_variations