Search Unity

Everything needs to be an addressable?

Discussion in 'Addressables' started by joshcamas, May 19, 2019.

  1. joshcamas

    joshcamas

    Joined:
    Jun 16, 2017
    Posts:
    1,277
    Hello!

    I have a game that has a lot of data that would be useful to be an addressable - specifically, new content such as meshes, materials, prefabs, and scriptable objects.

    In this case (assuming I use addressables), does that mean all of the references to this data needs to be redesigned to use addressables? For example, if I reference a material, do I need to load it via addressables? If so, how do prefabs reference materials without needing to load them via addressables, and instead references them the normal unity way?
     
  2. M_R

    M_R

    Joined:
    Apr 15, 2015
    Posts:
    559
    this is a limitation of underlying Asset Bundles:
    - if A has a direct reference to B and A is in an Asset Bundle, then B will be put in an Asset Bundle (the same as A unless you specify a different one)
    - if A has a direct reference to B and B is in an Asset Bundle, then A needs to also be in an Asset Bundle, or B will be duplicated (in the build and in the asset bundle)

    you can put everything in Asset Bundles and only load the root (e.g. initial scene) via Addressables. then everything will be loaded together.
    then you use Addressables to control what is loaded when (assets marked as addressable are put in Asset Bundles according to groups)
     
  3. joshcamas

    joshcamas

    Joined:
    Jun 16, 2017
    Posts:
    1,277
    Interesting... Let's say I go with that approach - essentially having a build with a little loading scene.

    I can still reference assets the normal way, as opposed to the addressable reference way? When do I do one or the other?
     
  4. M_R

    M_R

    Joined:
    Apr 15, 2015
    Posts:
    559
    everything with a direct reference is loaded together
    you should use Addressables when you want to control loading (e.g. if you don't need the boss at the beginning of the level, you load it via addressables when you reach it. or you only load the weapon currently equipped and unload when it changes)
     
    joshcamas likes this.
  5. joshcamas

    joshcamas

    Joined:
    Jun 16, 2017
    Posts:
    1,277
    Okay. So if I only want to use addressables to make assetbundles a bit better (since it supports the whole versioning thing), I don't really need to do anything special regarding loading?