Search Unity

Get list of dependencies via code

Discussion in 'Addressables' started by MagicDesignEmerick, Oct 16, 2019.

  1. MagicDesignEmerick

    MagicDesignEmerick

    Joined:
    Oct 4, 2017
    Posts:
    15
    I'm looking into addressables for our loading process, and I'd like to know if there was a way in the API to get the dependencies of an addressable asset.

    While there is a way to download in advance the dependencies of an addressable, I can't find a way to infer from this the list of assets effectively downloaded. (edit : see below)

    I'd like to get this list from an editor script, as it would be useful for our build process.

    Edit : I manageed to get the dependencies working in editor (using
    Addressables.LoadResourceLocationsAsync(asset); to which I supplied the wrong key before).
    But it's not working in the editor, from what I gathered the Addressable system cannot init in edit mode)
     
    Last edited: Oct 16, 2019
    csteinberg likes this.
  2. Jribs

    Jribs

    Joined:
    Jun 10, 2014
    Posts:
    71
    @MagicDesignEmerick Did you ever find a solution for this?

    Addressables.LoadResourceLocationsAsync(asset) doesn't give a list of dependencies. It just returns the items that are referenced by the given key.

    Edit: To clarify what I am looking for. I want to be able to know which bundles, not specific assets, will be downloaded when I do
    DownloadDependenciesAsync("myAsset")

    And I need to write an editor script that will spit out that information
     
    Last edited: Dec 6, 2019 at 11:15 PM
  3. BrokenAngel

    BrokenAngel

    Joined:
    Mar 24, 2013
    Posts:
    89
  4. Jribs

    Jribs

    Joined:
    Jun 10, 2014
    Posts:
    71
    @BrokenAngel it sounds like you are having a different issue, and you just need to use
    DownloadDependenciesAsync("myAsset")
    which will download everything required to load whatever key you put in.
     
  5. BrokenAngel

    BrokenAngel

    Joined:
    Mar 24, 2013
    Posts:
    89
    But I need to know which key is, and where I can get those keys ? since I want the application dynamically downloading all the "keys" I need in the server.
     
  6. MagicDesignEmerick

    MagicDesignEmerick

    Joined:
    Oct 4, 2017
    Posts:
    15
    @Jribs Unfortunately no, I've resorted to manually keep track of dependancies in our scenes with some calbacks when saving scenes.