Unity 5 has a new field in the Optimization section of “Other Settings” for Standalone builds:
Preloaded Assets
I’ve been unable to find any documentation that explains how this works. Presumably the memory you allocate for this gets used to permanently load assets, but is there any way to know which ones?
Edit: Never mind, I see the “Size” is the number of array elements, and you can specify a list of assets. I had assumed the Size was a memory value in bytes.
You’re correct that this is not documented at all, we just used it without even thinking about it too much.
When we ported our game to WebGL, we used streaming. This means that not all scenes and data is loaded when the game is already playable.
As such, it may be possible that you get into scenarios where a scene was loaded but some assets it needs that are loaded dynamically (e.g: Resources.Load) will not be ready.
To avoid this, we added these assets to “Preloaded assets”. The engine then makes sure these will be ALWAYS AVAILABLE from the second the game starts.
We did this for a couple of important data assets that had to be used early on in the game initialization.
So I assigned some models to my preloaded assets, and then they showed up blue (no texture/material) in game. So I removed them. Now they are still blue. Any ideas how to fix this?
========EDIT===============
It would appear this problem had something to do with my changes to the vertex compression settings, or something else in the Optimization GUI, and not the preloaded assets at all. Thanks anyway!
I have added a couple of ScriptableObjects to the Preloaded Assets list but they are not being loaded at player start up (their OnEnable is not being called).
(bump?!) Would this work for assets in the streaming assets folder in a web GL build? I have a small bug where videos in my web gl project get stuck loading (they are all streamed through streaming assets) and wondered if this would fix it.