Question about migrating from Asset Bundles

Hi there
We’ve been using asset bundles in our app for a while and I’m keen to migrate to Addressables while I have time in our project to test it.

How would I achieve the following which we had working with Asset Bundles.

  • We first download two “core” asset bundles without accessing any of their files. This is a preload step during initial loading
  • We cycle through a list of asset bundles and from each asset bundle we load a file
    called “SessionStructure.asset” of type SessionStructure. Each bundle has its own instance of this asset with the same name

I’m struggling to understand how this works because the auto migration converted all my asset bundles to groups - but groups are an editor only concept. I can’t, for example, have a ScriptableObject that has an array of editor groups that I can iterate through.
If I just request to load all SessionStructure assets somehow then how does the app know I have two bundles locally and three remotely that it needs to look in?

Thanks for any help. I’m finding the documentation still quite thin as to how this all works

Ok, I’ll give a few high level answers, which may not fully cover what you’re asking. If not, please reply with more detailed questions…

  1. if a thing is addressable (or a handful of things), and you ask for it, Addressables figures out where it is. So if you have 5 things you’re loading by label at once, and some are in local bundles, some remote, we’ll download what we need. If you have one prefab in a local bundle, dependent on a material in a remote bundle, we’ll handle that too.
  2. we don’t have a concept of downloading (or loading) a specific bundle. Instead, we have the concept of loading an addressable asset, or (in the next release) calling DownloadDependencies, which will make sure everything a given asset needs is on-device.
  3. for your “SO that has an array of editor groups”, this is where I start to get a little confused. What exactly are you after here? Again, in Addressables, you don’t need to say “get bundle X”, or even “get group Y”. You just say “get asset Z” and we figure out what bundle it’s in. So what you might store in an SO somewhat depends on what you’re actually trying to do here.

hope that guides you in the right direction. If you give me a little more context I should be able to answer with some more specifics.

-Bill

Thanks Bill
I’ve figured it out I think. Once I realised I could have assets with the same address but in a different group, it makes sense. So I can now say “get me all assets with the address ‘SessionStructure’” the loading step is taken care of.
One thing I’m having to work around is, previously I would know the name of the asset bundle I’d just loaded my session structure from. I was storing the session structure to a session manager alongside the name of the asset bundle. I could then later in the app load a scene file from the same asset bundle. Now, using the “get me all assets with address” method I don’t know where to find the associated scene file. I can get around this by saving a reference in the session structure to the scene file so its not a show stopper. Just need to rethink the way I’m solving the problem :slight_smile:

1 Like

you can’t put an asset and a scene in the same bundle, at least not since Unity 5

you can save the scene address inside your SessionStructure and load that

class SessionStructure : ScriptableObject {
    // your stuff...
    public SceneReference scene;
}