Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

include assets without referencing them

Discussion in 'Addressables' started by Cfirzi, Nov 5, 2019.

  1. Cfirzi

    Cfirzi

    Joined:
    Jul 30, 2018
    Posts:
    24
    Hey,

    I want to include some sprites into an Addressable asset bundle that are not referenced in that scene and I don't want them to have their own "addressable" address..

    is there a way to do that or configure that in addressables or do I have to add a reference for them in order to include them to this scene bundle ?

    Thanks !
     
  2. TextusGames

    TextusGames

    Joined:
    Dec 8, 2016
    Posts:
    429
    If you just reference them they will be duplicated in each separate bundle there you reference them.

    Why do not you want to make them addressables?
    And how do you want to access them without known address or reference )?
     
    Cfirzi likes this.
  3. Cfirzi

    Cfirzi

    Joined:
    Jul 30, 2018
    Posts:
    24
    its not that I dont want to make them addressables as I just not sure if thats my best option...
    Its a list of icons (about 40+) that I want to instantiate only on one scene, so I'm not really worried about memory duplication but I feel thats not so "elegant" way to do this..

    I guess there is not way around making it as an addressable group unless someone have better solution
     
  4. TextusGames

    TextusGames

    Joined:
    Dec 8, 2016
    Posts:
    429
    If you use them in scene that is not addressable you could make gameobject with component "iconHandler" which has a reference list of Icons.
    You than can access it and get icon by index.
    If scene is not addressable there will be no
    duplications. But this icons will be always loaded.
    Plus you will need to create an extra component and some how find or reference it.
    Creating addressable group called "AssetsForThatSpecificScene" seems like the best option for me.
     
    Cfirzi likes this.
  5. Cfirzi

    Cfirzi

    Joined:
    Jul 30, 2018
    Posts:
    24
    Thanks!
    I think the same, I think this is how I'll do that, it will require some refactoring on my part but this is the best option I can think of
     
  6. PaulBurslem

    PaulBurslem

    Unity Technologies

    Joined:
    Oct 7, 2016
    Posts:
    79
    Scenes and assets cannot be explicitly contained in the same bundle - Scene bundles are a bit special - they can contain multiple senes but not any explicit assets (by this i mean assets that are going to be loaded separately from the scene). Assets (actually just objects) will get pulled into scene bundles due to direct references. The solution that @TextusGames suggested should work fine since you are only using the sprites in that scene.
     
    Cfirzi likes this.
  7. Cfirzi

    Cfirzi

    Joined:
    Jul 30, 2018
    Posts:
    24
    Thanks for the response
     
  8. wangyucheng1992

    wangyucheng1992

    Joined:
    Feb 19, 2019
    Posts:
    59