So I just installed addressables and gave them a try. It looks promising, but not quite finished. What I miss most is some comprehensive documentation. I have following test scenario:
- there is a prefab instance in the scene. Prefab is addressable
- prefab has direct references to several other assets, of which some are addressable (in different groups) and some are not.
Idea was that when I run the game, it will automatically load all bundles with all addressable assets referenced in the prefab.
I clicked Build Player Content in Addressables window. Then I manually deleted all created asset bundle files in StreamingAssetsCopy. Then I chose Packed Play Mode in Addressables window, and clicked Play in editor. I expected error because assets would not be available (because all bundles are deleted), but no! Game plays as usual. How it is possible? Why the game does not load from bundles? What am I doing wrong?
you have this setup (“references” meaning “unity direct reference”). Scene references Prefab references stuff.
I’m guessing you are putting the scene in your build (build settings).
Which means, when you build addressables, you get:
- prefab put into bundles.
- other addressables put into bundles
- prefab and others’ dependencies put into bundles.
Now, what causes that prefab to be loaded form that scene? One of two things.
- you call Addressables.Load/Instantiate/whatever from your code to get the prefab. Sounds like you are not doing this.
- you use Addressables to open a scene that is referencing this prefab as a dependency.
Sounds like you are actually doing #3:
3. open a scene, not through addressables. this will not point to the prefab in the bundle.
During a build, any scenes included in the build pull in all their dependencies (creating copies). So if that scene of yours is in the build directly, then it’ll never reference/load/care-about the prefab in the bundle. If you go as far as to make the scene addressable, and open it in your game via addressables, you still need to be aware of how it’s opened in Play mode in the editor. If you use a bootstrap scene to open it (see scene example in GitHub - Unity-Technologies/Addressables-Sample: Demo project using Addressables package), then it will load from bundles. If instead, that scene is the currently open one, then the editor does some magic to open the scene and it’s dependencies directly from your source.
Hope that helps.
1 Like