The config.json file is too large. Procedure

Suppose I create multiple scenarios in a project, each using different resources. However, the packaged config.json file contains resource information for all scenarios. As a result, this file is extremely large and takes a long time to download, but I only used the resources for the current scenario. How can I reduce the confige.json file size in this case because I don’t want to reload the accessed resources when I return after switching scenarios? Or how to separate resource files for different scenarios, but do not need to reload when switching repeatedly?

Hi @angus_young,

So using the asset Exclude flag in the editor you can control which assets aren’t included in the build, reducing the final size.

Of course it’s not easy to do that manually each time, unless you have naming schemes in your assets and you can easily filter them with the asset search field (to multiselect and toggle Exclude in the Inspector).

To better automate that you could use the PlayCanvas editor API. For example you could add tags to your assets per scenario and use an editor method to find and set the Exclude property accordingly prior to a build.

2 Likes

If you are using Templates, please read this section: https://developer.playcanvas.com/en/user-manual/templates/#when-do-i-need-to-load-template-assets?

TDLR: If you don’t need template assets at runtime, then either exclude them or untick preload. This removes a good chunk of JSON from the config.json

Also, the JSON will compress quite nicely with GZIP. So even if it’s quite large on disk, if your server supports GZIP, it will be a fraction of that size on download to the user.

1 Like