Give Page Feedback | API

Chunk Streamers - Addressable Prefab Streamer

This Chunk Streamer can be used to load and unload Addressable Prefab Assets. It is capable of single frame loading on every system but WebGL, however under normal runtime operation it uses Addressables.LoadAssetAsync for more performant loading. Unloading Assets uses either GameObject.Destroy or a provided Chunk Destroyer.

--Special Note--
Addressable related content requires the Addressables package (any version) to be installed in your project, otherwise you will not be able to see/add addressable related components. Once added, you may need to restart Unity in order for this content to become available.

Creating An Addressable Prefab Chunk Streamer Component

You can add this component manually by selecting a game object and then selecting from the Top Menu Bar:

Component -> Deep Space Labs -> -> SAM -> Chunk Streamers -> Addressable Prefab Chunk Streamer

Adding An Addressable Prefab Chunk Streamer Component From The Top Menu Bar GIF

or by selecting a game object and using the Add Component menu via its inspector:

Component -> Deep Space Labs -> -> SAM -> Chunk Streamers -> Addressable Prefab Chunk Streamer

Adding An Addressable Prefab Chunk Streamer Component From Add Component Menu GIF

Pre Calculate IResource Locations

Hover over the setting Label to see information about this setting.

Prepending/Appending Extra User Data

These settings are used to add to the beginning/end of the Asset Chunk Names extra string data, in order to form complete and valid Addresses for each Addressable Prefab Asset.

Prepended user data can be used to add folder paths or other literal strings in instances where you Asset Addresses include a folder path or additional characters before the Asset Name (folder paths are automatically added when dragging/dropping assets into an Addressable Group). You can hover over the setting Label to see more detail information.

Appended user data can be used to add extra string data after the Asset Name. Typically this will just be the .prefab file extension, however if you know that all Addressable Asset Chunks will utilize this extension, it can be more memory efficient to enable the Append File Extension setting instead, as this will reduce the amount of extra user data on Streamable Grid assets.

If, on the other hand, only a limited number of Asset Chunks use the extension in their Addresses, you will need to use appended extra user data. When doing so, include the extension as extra user data on the Streamable Grid associated with the Assets, using the same key as found in the Append Data Key field.

When the Streamer finds that an LOD Group has the user data, it appends it to the Asset Chunk name. If it finds that an LOD Group does not have user data, it appends nothing, so Asset Chunks that do not need the extension work just as well as chunks that do need it.

Note that using this method, you can also append unique string data for each LOD Group.

Interested In Extra User Data?

Appending File Extension

If all of your Addressable Scene Assets contain the .prefab file extension in their Addresses, you can enable this option and the .prefab extension will be added to the end of each Asset Chunks name in order to form the Address used to load each asset.

If some Asset Chunks have the extension but others don't, you will need to disable this option and instead use the Append Extra User Data options described above.

Error Repairing/Handling

Since working with internet based loading can be consist of packet loss and connection issues, the Addressable Prefab Chunk Streamer contains some rudimentary error handling routines in cases where load operations fail. These routines proceed in the following order:

1) Try to re-download the failed Prefab Asset X times, where X = Max Load Attempts - 1 (i.e., a value of 1 means no re-downloads will be attempted).

1) 2) If those re-downloads fail, attempt to fix whatever issue is causing the failed downloads using a provided Error Repairer. Note, error repairing is an advanced technique and you must design the repairer yourself.

3) If the repairer fails (or a repairer is not provided) and Use Alt LOD Fail-Safe is enabled, the Streamer identifies the Streamable Grid the failed Chunk belongs to, then identifies the lowest quality LOD for that Grid and (if it is different than the failed Chunks LOD) attempts to load the equivalent Asset Chunk for that LOD.

4) If the Alt LOD Fail-Safe cannot or should not be loaded, and Use Placeholder Fail-Safe is enabled, a placeholder asset will be loaded. The placeholder asset should be placed on the users' computer so that loading it cannot fail.

5) If all of the previous steps fail to load an asset for the given Asset Chunk, a MissingAssetException is thrown by the Streamer.

Want To Know More About Custom Error Repairers?

If enabled, the Print Error To Console setting will cause an error to be printed to the console log any time an asset load fails. This includes any attempts to load the Original Asset, attempts to load an Alt LOD Fail-Safe Asset, or attempts to load a Placeholder Fail-Safe Asset.

The Exception Handler field allows you to provide a custom exception handler for handling different exceptions that may be thrown by Unity's Addressable Loading Systems. If not provided, the default behavior is to only catch and log Invalid Key Exceptions. If you would like to catch other exceptions and/or deal with them in a more advanced way than simply logging the exceptions, you can create a custom Exception Handler class (note, this class will not catch exceptions thrown by the Streamer itself!).

Want To Know More About Custom Exception Handlers?

Hover over the settings' Labels to see information about these setting.