The examples I’ve seen on the learn playcanvas site, and from forum posts, show templates that exist in the hierarchy (disabled) being cloned. This seems like a strange approach to me - what’s the point in making templates if they have to exist in the hierarchy? And isn’t there any downside to having loads of entities, albeit disabled, in the hierarchy?
I’d rather instantiate templates without having them in the hierarchy at all - is this possible?
Those templates might be some sort of reference, and if not I also do not see any reason for that to occur. You want to instantiate the templates without the hierarchy, and I have done this already and I would suggest a couple ways.
Create an attribute to store the specific template you wanna create
In order to do this way, just make an attribute that has:
Makes sense, and I know keeping documentation up to date is a nightmare given how fast things move. I wonder if there’s a way the community could suggest edits to the docs, to be reviewed/edited/accepted by the PlayCanvas team to keep them up to date…
I picked ‘chhesTemplate’ because its something out of the box so I was hoping you would know it was something that you can name as anything. (It means you can name that ‘chhesTemplate’ to whatever you want)
The templates can be uniquely named and stuff, its all customizable. I just picked that name for fun and cause chhes. In order to set the template as something just drag a template onto the script which has been added to an entity, but you probably already know that.