Search Unity

Resolved Add addressable label at runtime

Discussion in 'Addressables' started by jeppe79, Jul 16, 2020.

  1. jeppe79

    jeppe79

    Joined:
    Sep 17, 2019
    Posts:
    76
    Hello,

    I am loading and instantiating multiple textures with a single label,
    however, when clicking on one of the textures I would like to add a label with a unique ID string to that specific asset in the Addressables group.
    So that I can access and instantiate that specific texture again with its' unique label (the ID string) after all instances have been released. (Without reloading all of them again and find it with a loop).

    Is it possible to add labels at runtime?
    If so, how?
     
  2. brunocoimbra

    brunocoimbra

    Joined:
    Sep 2, 2015
    Posts:
    679
    No AFAIK, but you can use LoadResourceLocationsAsync(someLabel), this will return a List<IResourceLocation>, which each element represents a single asset (and you can use this IResourceLocation as the key for LoadAssetAsync/InstantiateAsync)
     
    jeppe79 likes this.
  3. jeppe79

    jeppe79

    Joined:
    Sep 17, 2019
    Posts:
    76
    Interesting, I will test that out.
     
  4. jeppe79

    jeppe79

    Joined:
    Sep 17, 2019
    Posts:
    76
    Yup, that worked great for my project.
    Big thanks!
     
    brunocoimbra likes this.