I’m working on a project with multiple environments (like a city / or an amusement park), and select the correct environment at startup. If one environment is loaded, then there is no need to download the assets of the other environments.
In order to optimize the loading time and avoid downloading everything, I deactivated preload of every mesh that’s not shared between the environments, so that they are downloaded only when I activate the environment they belong to.
I am now facing an issue with entities that contain such non-preloaded assets and that have a collision component :
Assuming you are using render assets for collision meshes, there’s an issue where you need to ensure the container that the render asset is referencing first.
The general practise is to load all your assets before loading the scene that they are being used in first.
Could you please rephrase that ? I am not sure I understand what the issue is
So if I understand right, unchecking preloading only makes sense when working with multiple scenes ? I cannot work with multiple scenes as I have a ton of logic that needs to be shared between them. Besides i do not know at first which environment to load, that is provided by API later on. It is way easier for me to have all my environments in one scene, and then enable / disable the entities once I got the response
I see… That is an issue for me as I’m supposed to develop more and more environments, and i cannot really afford to make everybody download all the meshes (even thoses they won’t need). Do you see a way I can do that differently ?
edit : I’m thinking of the following solution :
Tagging all assets depending on what environment they belong to, and making sure I download them all using this : Preloading and Streaming | Learn PlayCanvas before I make the switch to the other environment. What do you think ?