Accessing tags and scripts of template attributes

Hi everyone :slight_smile:

I have a script with an asset attribute (of type “template”), named “model”. Its value is a template containing scripts and tags.
When I access this attribute, I get my template but not the tags or scripts, I have to instantiate the template first.
I can find the tags by using the internal object “_templateRoot” but I know I shouldn’t use these.

Problem is, I actually have a list of asset attributes and I use these tags to identify them :slight_smile:
Should I instantiate them all in a loop to find the one I need, or is there another way?

I already have other attributes attached to it, so I guess I could add another field with more info, but the tags are a cool way of finding things already :slight_smile:


Thanks in advance for the help !

Unfortunately, there is no public API to access the data you want from the template asset

IIRC, the template asset stores the data as a JSON object but that is not public API and shouldn’t be relied on.

What is your use case to need to access that data from the asset?

I’m making a product configurator, where the user can select a number of filters to find models.

For example, the user choses “round”, “left facing”, “flush” and I use these strings to match with the tags of one or many templates in my asset list attribute (or even none).

There are multiple ways to do this of course but my first idea was to use tags, as I use them a lot with already instantiated templates :slight_smile:

Hmm, I can’t think of a way around that without also tagging the template asset itself :thinking: