diff --git a/content/en/user-manual/optimization/load-time.md b/content/en/user-manual/optimization/load-time.md index 75b2175089..e949a71c2b 100644 --- a/content/en/user-manual/optimization/load-time.md +++ b/content/en/user-manual/optimization/load-time.md @@ -12,6 +12,7 @@ Here are some tips to achieve super-fast load times: * Look for opportunities to downsample certain texture images. For example, a 2048x2048 texture that is used on a small graphical object may look almost exactly the same at 1024x1024 or even 512x512. * Don't preload assets which can be loaded asynchronously. For example, it may not be necessary for your game music to play immediately at game start, so consider unchecking the Preload option for that asset in the Inspector panel. * If you have a prefiltered cubemap and are not displaying the top-level mipmap for the skybox, you can uncheck preload for all the 6 face images. +* If you are not instantiating Templates at runtime, uncheck preload on the asset as they aren't needed. (See '[When do I need to load Template Assets?][2]' for more information). * Ensure that imported models only have the vertex attributes that you need. For example, if your model has a second set of UVs but doesn't use them or if it has all-white vertex colors, go back to the modeling application and delete those attributes. * Use the Networking panel in Chrome Dev Tools (or the equivalent in other browsers) to sort loaded assets by size and look for anything that stands out. Look for assets that are not used and could be deleted. Look for assets that are essentially duplicates and delete them. * Using PlayCanvas' built-in physics engine incurs an additional download cost of 379KB. If you are using the physics engine to solve very simple problems, consider rolling an alternative solution that doesn't incur the download penalty. @@ -53,3 +54,4 @@ An example below is using a silhouette of a character as the placeholder until i [1]: https://www.miniclip.com/games/virtual-voodoo/en/ +[2]: /user-manual/templates/#when-do-i-need-to-load-template-assets? diff --git a/content/en/user-manual/templates/index.md b/content/en/user-manual/templates/index.md index 31caede4a9..b94d5022a0 100644 --- a/content/en/user-manual/templates/index.md +++ b/content/en/user-manual/templates/index.md @@ -89,6 +89,14 @@ this.app.root.addChild(instance); You can also use Script Attributes to pass Template Assets to your scripts instead of searching for them by ID. +## When do I need to load Template Assets? + +Templates store the Entity hierarchy and data, similar to scenes. When a template instance is added to the scene in the Editor, the Entity hierarchy and data is included in the Scene data. + +At runtime, the Template instance is not linked to the asset and you can reduce the download size by not preloading/loading the asset. + +You only need Template assets to be loaded if you are instantiating instances at runtime. + [1]: /images/user-manual/templates/hierarchy.png [2]: /images/user-manual/templates/inspector.png [3]: /images/user-manual/templates/override.png