Working with Addressables - WhateverDevs/SceneManagement GitHub Wiki
Creating your build path
The default build paths in the Addressable system point to the Library folder, so we recommend creating your own. On the Addressables Groups window, click on Profile and then Manage Profiles.
Then create a new profile.
Rightclicking the new profile will allow you to rename it and set it as active.
Now on this profile variables we recommend changing the LocalBuildPath to "Bundles/[BuildTarget]" and the LocalLoadPath to "Bundles". What this will do is building the path to the Bundles folder inside a folder for each build target. Then the applications will load the bundles from a Bundles folder. Of course, you can change this to whatever needs you have.
Adding assets to the system
To make an asset addressable, you just need to drag it to the Addressables Groups window. In this case we have 3 scenes that we are going to separate in two addressable group. We'll start by dragging the three of them to the default group.
The path column doesn't matter to us, so we can hide it by right click the upper bar. Also clicking resize to fit after wars will make the ui cleaner.
By default, the assets get their path on the assets folder as their name. We normally just change it to the asset name. You can do this by rightclicking the asset and clicking on simplify name.
Now we can right click on the empty part to create new groups. Rightclicking the groups will allow us to rename them. Finally we can drag the assets to the new groups. We can set it up like this:
The other important thing is that we should label the assets to be able to easily access them. We usually label all scenes "Scenario". You will need to create the labels first by clicking on manage when you try to set a label. You can set any number of labels per asset. Our system will afterwards create more labels automatically when building the bundles.
Setting up build paths and manifests
Each group can have a different build path and load path, which are selected from the profile we setup earlier. If you go to Assets/AddressableAssetsData/AssetGroups you will see that there is a scriptable for each group. You can see there is also a templates folder, you can create new scriptables on that folder and use them as templates when creating new groups.
If you click on a group you will see its build and load paths. We will change them to local to use the ones we changed on our profile earlier.
These paths actually reference to a schema scriptable you can find on the schemas folder, you can setup more advanced settings on that schema.
Now that our assets and groups are ready, let's go to our Version Depencency scriptable, you'll see that our two groups show up and it's asking us to create a manifest.
After creating the manifests, you can modify them on their own scriptable or all together on the Version Dependence one. There are 4 values to take into account.
- Manifest version is the version of the group you can manually setup. You will use this to keep track of the changes on the asset group.
- The manifest full version is the actual real version of the manifest. The suffix will be added when building the bundles but you can also click the button to update it manually.
- The minimum app version is the version of the app the manifest requires to run. You can have a higher app version, but the system will complain if you have a lower one.
- The minimum manifest version is the version of the manifest the app needs. Again, the app will be able to work with a higher version of the group, but not a lower one.
Building bundles
After setting all our assets and groups, the only thing left to do is building. You can do this on the Addressable Builder scriptable. This scriptable will set some more labels and make sure the groups are setup correctly before building. You just need to setup a reference to the dependence library and click build.
After building, you will find the bundle files on your build target. Remember that for you app to find the bundles you need to place them on the corresponding path that you set on the Load Target.