How to preload assets when running html5

my project runs fine when exported in html5, except that the game has little lags when loading a new resource (mesh, or image). Is there a way to preload everything at the beginning ?
Some of my object have to be spawn later in the game. Do I need to spawn them and remove them immediately at the start, so they remain in memory to avoid lags ?
(I think this is my last question before releasing my game, it’s almost finished :slight_smile: )

1 Like

Well, I found a way…
Duplicate every object you want to preload, create an empty called “Preload”, and make it parent of the duplicated objects.
Then… pick every child object and change it’s mesh to the original.
ex : you have an object called “car”, that has a mesh called “car”. You duplicate it and then have another object called “car.001” with a mesh called “car.001”. After you parented it to the empty “Preload”, change it’s mesh in the 'object data property" panel image to “car”. So the mesh will be loaded at start.
If you had previously unset the spawn option, don’t forget to set it again.
Then and a trait to the Preload object :
so everything is unloaded just after.
It’s a bit fastidious as you have to do it for every object, but it works.