[SOLVED] [ENGINE ONLY] How to create a Player template

Hi,

just wondering how it would be possible to create a player template / entity for 3rd person controller
programmatically?

To achieve e.g. something like this: Third Person Controller - PLAYCANVAS

Or is it possible to export such template from the Editor?

This is a bit tricky as Templates weren’t really designed for engine only use.

Template assets are JSON files under the hood and share similar (if not the same) format as scenes which means they are referencing after assets by asset id etc.

There’s thread on creating and editing templates at runtime but this is not a supported usecase: Create & Edit Templates at Runtime

You can get the template asset data from an Editor project in a roundabout way.

On the template asset, disable ‘preload’ and download a build of the project.

The template asset will be in a separate JSON file under a separate assets folder.

Hmm, I see, well in this case I might be easier to programmatically create the player entity. Is there an example to start with?

There are many engine only examples here: PlayCanvas Examples

1 Like

And a small example here: https://developer.playcanvas.com/en/tutorials/programmatically-creating/

1 Like

I should even better read the docs, thanks guys!