Search Unity

Question Addressable loading mode in Edit Mode (not in Play Mode)

Discussion in 'Addressables' started by fherbst, May 21, 2021.

  1. fherbst

    fherbst

    Joined:
    Jun 24, 2012
    Posts:
    802
    For our workflows, we often build simple wrappers that load stuff OnEnable in edit mode (e.g. loading files from disk), marks everything as DontSave, and people can work as if the asset is "fully there".

    However, it turns out that the "Play Mode Script" dropdown that allows to switch between "fake loading by just using the prefab directly" and "actual loading from disk" is only effective in Play Mode (as the name implies). How can we specify that this should be used in Edit Mode as well?

    upload_2021-5-21_13-14-30.png
     
    dimmduh1 likes this.
  2. CDF

    CDF

    Joined:
    Sep 14, 2013
    Posts:
    1,311
    Unfortunately you can't use the load methods at edit time. You need to use the "editor asset" property on AssetReferences to load in edit mode
     
  3. fherbst

    fherbst

    Joined:
    Jun 24, 2012
    Posts:
    802
    The load methods itself work fine at edit time, they just use the wrong source (always AssetDatabase).
    Are there docs for that "editor asset" property? Haven't seen that anywhere so far.