Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Question Can I get the address from label load object?

Discussion in 'Addressables' started by Nkp46, Nov 3, 2022.

  1. Nkp46

    Nkp46

    Joined:
    Nov 10, 2016
    Posts:
    8
    I am passing a Label to LoadAssetsAsync to load multiple objects.
    But I don't know what the Address Name of the loaded file is
    Is there a way to find out what each Address Name of an object loaded using Label is?
     
  2. LuGus-Jan

    LuGus-Jan

    Joined:
    Oct 3, 2016
    Posts:
    169
    No, this information is not available at runtime. The addressables loading system is a one-way street: you provide the address, label, or reference to load and you get the asset back.

    There are ways you can technically get the information (in the end, the catalog file does contain this information after all), but it's not readily available as is.
     
  3. Nkp46

    Nkp46

    Joined:
    Nov 10, 2016
    Posts:
    8
    Thank you for answering.
    I have confirmed that it is impossible.

    Now I'm thinking of loading asset by location information.

    After getting the location information by Label , cache the PrimaryKey array contained in the location information.
    Presumably PrimaryKey looks like AddressName.
    Then use the location information to load the Asset.

    But I still have questions.
    It is unknown whether the order and number of the Result array returned by LoadAssetsAsync and the PrimaryKey array match always.
    I can associate PrimaryKeys and Assets by passing PrimaryKeys one by one to LoadAssetsAsync to load them, but I'm also worried that this will affect performance.
     
  4. Nkp46

    Nkp46

    Joined:
    Nov 10, 2016
    Posts:
    8
    I tested the loading time.
    Passing the location data one by one to LoadAssetsAsync and loading them increased the loading time by 10-20% compared to passing an array.
    Associating AddressName and Asset after loading , ,it's not seem very good for performance.