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. Dismiss Notice

Question AssetReference.editorAsset on Android?

Discussion in 'Addressables' started by Hvglaser, Jul 10, 2023.

  1. Hvglaser

    Hvglaser

    Joined:
    Feb 27, 2020
    Posts:
    2
    When trying to build for Android, I get this:

    'error CS1061: 'AssetReference' does not contain a definition for 'editorAsset' and no accessible extension method 'editorAsset' accepting a first argument of type 'AssetReference' could be found (are you missing a using directive or an assembly reference?)'

    I'm in unity 2020.3.33f1

    Is this just a limitation of Android, or does anyone have any leads on how to fix this?
     
  2. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    5,769
    Nothing from the editor API can be used in a build. the
    .editorAsset
    is surrounded by
    #if UNITY_EDITOR
    pre-processors (hence 'editor' in the name), so it can't be used in any build on any platform.

    You will need to change your approach.
     
  3. Hvglaser

    Hvglaser

    Joined:
    Feb 27, 2020
    Posts:
    2
    Ah, makes sense. Thanks!