Fetching template from external storage


Does anyone know a method for saving a PlayCanvas template (with all its contents) on an external server and fetching it in various other projects? Alternatively, if there is a method to fetch a template from one project to another at run-time?

In our company we start to have a lot of different project, which share some of the same assets. It would be very convenient if there was a way to have a common source of truth. We already do so for several image files and glb files, but for some of the more complex assets things like tags, scale, material settings and internal positioning would be needed in order for the asset/template to look and behave properly.

Unfortunately, there is no way to do projects as submodules. At best, you can copy folder assets or assets across projects the ‘one time’ where you can’t overwrite existing assets via this method.

I believe it is possible to load templates externally but will require some set up on your part.

If there is a common set of assets, what I would do is have that in separate project. Export to self host and that will have a config.json file that stores all the asset data in the asset registry and the application.

Strip that file so that it only have assets JSON data and prefix the asset URLs to have the full URL server path of where you would be hosting these.

In projects that use those shared assets, they can load that config.json and then add the assets to it’s own asset registry at runtime. Similar to how the engine does it here: engine/app-base.js at main · playcanvas/engine · GitHub



I’ll ask my other team members if we can try doing that!

1 Like