How does "Preloaded Assets" in Player Settings Work?

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.

1 Like

@liortal So using “Resources.load” will not give any hiccups if you preload them via build settings?

Depends on what you mean by “hiccups”.
That setting means that the player will handle loading these assets by itself, before the player starts.

This will add some loading time of course.

occasionally i get spikes when i use “Resoures.load” for the first time, i use pooling after that. So i think preloading might help me there.

Did it help by preloading or do i have pool the assets ??

you will still have to pool it.

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!

Do you mean ScriptableObjects?

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).

1 Like

Bump! Never did figure this one out.

bump??

bump

bump

Bump

Bump

bump

Bump party!

lmao unity is trolling us

2 Likes

(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.

1 Like

BUMP!