All Addressable related code is provided as source code within the project, in special folders that have been configured with Assembly Definition Files that detect whether Unity's Addressables package is in your project.
If this package is not in your project, the source code is either stripped of the parts related to Addressables, or stripped completely. This allows the Addressable related SAM Source Code to sit in projects with and without the Addressables package.
Please keep in mind that the Addressables system is somewhat complicated and recommended for users who know what they are doing! We do not offer assistance in setting up standard Addressable settings; you must navigate these settings yourself by watching tutorial videos or using Unity's documentation.
The Addressables package can be added using Unity's Package Manager
There are no version requirements for which Addressables package you use, however we recommend using the latest one available with your Unity version as it will usually be more stable and contain less bugs.
Obviously, if your project already contains an Addressables Package, you can skip this step, however if you are not on the latest version we encourage you to upgrade.
All code needed to support Addressable use with the World Designer tool is already included, however you need to execute the following two Assets Menu commands in order to enable Addressable Use with the World Designer Tool:
1) Assets - > Deep Space Labs -> SAM -> Regenerate Default Addressable Prefab Asset Manager
2) Assets - > Deep Space Labs -> SAM -> Regenerate Default Addressable Scene Asset Manager
These commands create two new Asset Manager assets inside of the Assets/Editor Default Resources/Deep Space Labs/SAM/AssetManagers folder, which are required by the World Designer tool to work with Addressable Assets. For now, that's all you should need to know, however if you are interested in learning more about Asset Managers, you can open the relevant Section using the button below.
--Special Note--
If you do not see these commands in the Assets Menu, you likely need to Save and Close your Project and reopen it. This will refresh the Assembly Definition Files and enable the source code that is Addressable Dependent.
Runtime streaming of Addressable Assets is performed by a Chunk Streamer configured to load them. By default, we include two Streamers that fit this criteria, the Addressable Prefab Chunk Streamer and Addressable Scene Chunk Streamer. It should be evident, but the difference between the two is that one is setup to load Prefabs and the other Scenes.
You are free to create a custom Chunk Streamer that streams in these Addressable Assets in a different way, or one that is capable of streaming in different types of Addressable Assets. For now, however, it should be sufficient to start using one of the two default Streamers. You can find more information about them using the buttons below.
At this time we cannot recommend an optimal layout for Addressable Groups. Generally speaking, it is easiest to place different Asset Groups into different Addressable Groups, however this is not a requirement and you may deem a different strategy to be better suited for your project. Some of the different possibilities include (note, this may not be all of the possibilities):
1) One Addressable Group per LOD Group (e.g. if you have one Streamable Grid with 3 LODs, you would end up with 3 Addressable Groups).
2) One Addressable Group per Streamable Grid, with or without Labels.
3) Multiple Asset Groups from different Streamable Grids in a single Addressable Group, with or without Labels.
4) All Asset Groups in a single Addressable Group, with or without Labels.
Because each Group can use different settings, which Asset Groups need which settings will largely determine your Group Layout. For example, if using a remote server to stream assets, it can be advantageous to place fail-safe assets on the user's computer, which will usually be the lowest quality LOD Group Assets. This allows those Assets to be loaded in when the assets from the remote server cannot be loaded (due to an internet outage or whatever reason).
This strategy can only be achieved by placing the lower quality LOD Group's Assets in a separate Addressable Group set to build/load to/from a local path.
The Bundle Mode (found in each Group's settings) determines how different Assets in the same group are packed together into bundles. Whenever an addressable asset is needed, the entire Bundle the Asset is packed in is retrieved from the location where it is stored (remote server or locally) and downloaded to the device.
While Unity's documentation implies that only the needed asset is loaded into game memory, that asset will not be unloaded automatically until all assets from the same bundle are unloaded. The more Assets you bundle together, then, will increase the probability that Assets will not be unloaded when they are no longer needed. While you can override this behavior and unload those assets forcefully using Resources.UnloadUnusedAssets, Unity does not recommend using this method as it can cause hitches in gameplay.
While it may seem like the solution is to pack all Assets into separate Bundles, this strategy has its own shortcomings, mainly that it increases the number of Asset Bundles used. Since each Asset Bundle has its own memory costs, this can potentially increase the memory used by your game.
You will need to profile your game to see which options work best, however at this time we recommend going with Pack Separately for the Bundle Mode and only changing things if you notice memory problems related to the number of Addressable Assets being used.
If you already have Prefab or Scene Asset Groups and want to convert them to Addressables, the process is very simple. Simply create an Addressable Group to add the Addressables to, select all of the assets from the same group that you want to convert, and drag them onto the Group via the Addressables Group Window (Window -> Assets Management -> Addressables -> Groups.
When you drag and drop assets in the way described above, the addresses of each Addressable Asset automatically includes the folder path where the assets are stored. While this is beneficial in many ways, issues can arise on some Operating Systems such as Windows because the final output folder path where the Asset Bundles are built can become longer than the allowed amount.
As such, we recommend placing Addressable Assets at most 1 sub folder deep within the Project Hierarchy, and using a very short sub folder name. In addition, if possible, the common name all Assets in the Group share (the Group Name) should be as short as possible. Doing so will reduce the likelihood of this being a problem. If there is an issue, it will appear during the Addressable Build operation.
If you are using Asset Creators to create your Addressable Assets, you can also setup the Creator to not include the folder path at all in the Address. Do note that you must ensure all Addressable Assets are uniquely named when doing this.