Search Unity

[Solved] Unable to load addressable asset via its addressable name

Discussion in 'Addressables' started by MaskedMouse, Sep 3, 2019.

  1. MaskedMouse

    MaskedMouse

    Joined:
    Jul 8, 2014
    Posts:
    1,092
    I've got a static class that is initialized before scene load. Play mode is set to Fast Mode. The "Application Settings" addressable bundle is set to local load.
    Addressables version 1.1.10

    Code (CSharp):
    1.         [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
    2.         private static async void Initialize()
    3.         {
    4.             // Init server settings
    5.             ServerSettings.InitializeSettings(await Addressables.LoadAssetAsync<ServerSettingsScriptableObject>("Server Settings").Task);
    6.             Initialized = true;
    7.         }
    Addressables.png

    Is loading the addressable by its name is not possible? I'm getting an invalid key exception, though if it were to be a label I can load it. But making a unique label for every asset seems annoying.

    Since the class is static I can't serialize a AssetReference, so instead I want to use the address name to load it but it doesn't seem to work.

    edit: seems like the address name may not contain a space in between. After I removed the space the key worked.
    Is this perhaps a bug?
     
    Last edited: Sep 3, 2019
    unity_bill likes this.
  2. Favo-Yang

    Favo-Yang

    Joined:
    Apr 4, 2011
    Posts:
    464
    Sounds like a bug, space is allowed in address naming.
     
    unity_bill likes this.