Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Get the address of a loaded asset.

Discussion in 'Addressables' started by wusticality, Jun 22, 2019.

  1. wusticality

    wusticality

    Joined:
    Dec 15, 2016
    Posts:
    47
    Hello,

    In our game we cache a bunch of assets by label so that they are all loaded once the game begins. Ideally, we would store a mapping from address to asset in a map. Currently, it doesn't seem easily possible to get the address of a loaded asset.

    We wanted to request that there be a mechanism to get the address associated with an asset at runtime. For example, something like this:

    var request = Addressables.LoadAssetAsync<Material>("game.materials.foobar");

    yield return request;

    var asset = request.Result;

    // Prints "game.materials.foobar".
    var address = Addressables.GetAddress(asset);
    Debug.Log(address);

    Is this on the roadmap, and if not, is it something you can add soon?

    Thanks,

    Kevin
     
  2. Favo-Yang

    Favo-Yang

    Joined:
    Apr 4, 2011
    Posts:
    329
  3. wusticality

    wusticality

    Joined:
    Dec 15, 2016
    Posts:
    47
    Unfortunately PrimaryKey is not supported yet on IResourceLocation as near as I can tell. Not sure on the ETA of the next release.

    EDIT: Aaaand it just dropped, 5 minutes later haha
     
    Last edited: Jun 23, 2019