Search Unity

is Addressables.LoadAssetAsync meant to work in editor (non play mode) ?

Discussion in 'Addressables' started by XRA, Apr 13, 2020.

  1. XRA

    XRA

    Joined:
    Aug 26, 2010
    Posts:
    265
    I have code that async loads shader resources for a custom renderpipeline, but am finding that Addressables.LoadAssetAsync doesn't complete when outside of playmode.

    I've also noticed that there are some monobehaviours that are created after each assembly reload (EventCollector and ResourceManagerCallbacks).

    IS this just user error, or is it unsupported? It seems like it should be supported.

    *EDIT* looks like async await doesn't work in editor...
     
    Last edited: Apr 13, 2020
    phobos2077 likes this.
  2. Ferazel

    Ferazel

    Joined:
    Apr 18, 2010
    Posts:
    517
    It would be very nice for editor tools to share the same code path as play mode and have the addressable system handle loading from the AssetDatabase when in edit mode automagically. However, it doesn’t work that way and you need to write a split code path on your load logic to try to load directly from the AssetDatabase for edit mode scripts. :( which means you need to either store asset GUIDs or asset paths manually. I would really like this feature though if we could setup a roadmap (like the URP team I’d vote for it).
     
    phobos2077 likes this.
  3. Thermos

    Thermos

    Joined:
    Feb 23, 2015
    Posts:
    148
    checkout AssetReference.editorAsset.
     
  4. phobos2077

    phobos2077

    Joined:
    Feb 10, 2018
    Posts:
    350
    Ok, now I need this feature badly. I'm porting over some abstractions that used Resources.Load to Addressables (the goal is to get rid of using Resources folder and move everything to bundles). Resources.Load which we use works perfectly fine in the editor, while there is no direct alternative in Addressables.

    Looks like I'll have to invent some kind of duplicate logic for the editor to support this. Not ideal :(
     
    tommyvisic likes this.