Search Unity

If I have an addressable scene/prefab, should the materials/sprites etc also be addressable?

Discussion in 'Addressables' started by Yukken, Nov 5, 2020.

  1. Yukken

    Yukken

    Joined:
    Jul 12, 2015
    Posts:
    93
    The asset bundle browser tells me that common sprites/materials between addressable prefabs will be duplicated in the build. Should I turn them each into separate bundles? Or, should they be packed together in a large bundle? Is there a performance difference if I have a huge number of bundles with one item each?
     
  2. magmagma

    magmagma

    Joined:
    Oct 27, 2017
    Posts:
    41
    Duplication occurs commonly when you have both direct references and also addressable references.
    E.g. you have some stuff set up in a non-addressable scene, but then you have an addressable scene which also includes the same stuff.
    If you have an addressable scene that has assets that are only used there, you don't need to specifically also make them addressable and load them from a bundle.

    I did try to do that at one point and it just broke everything... so I would not recommend it.. ha! I ended up just removing all the stuff that scene used from the bundles and so it just automatically creates it's own when building.
     
  3. therobby3

    therobby3

    Joined:
    Jan 30, 2019
    Posts:
    131
    If an asset is used in multiple scenes or in multiple prefabs, those individual assets should be marked as addressables to prevent duplication. So YES, they should be marked as addressables also.
     
  4. Yukken

    Yukken

    Joined:
    Jul 12, 2015
    Posts:
    93
    Should each of them be on it's own bundle? Because if every mat/ texture is a separate bundle, it's going to be a lot a bundles.
     
  5. magmagma

    magmagma

    Joined:
    Oct 27, 2017
    Posts:
    41
    You don't need to put every single material or texture in it's own separate bundle. You can put them together if it makes sense for your project.
     
  6. tgrotte

    tgrotte

    Joined:
    Apr 17, 2019
    Posts:
    25
    In regards to your latter questions, take a look at this page on preparing assets for bundles. I think you'll find the bulleted section at the end of the page useful. You can use the profiler to analyze performance differences.