Search Unity

editorAsset is buggy

Discussion in 'Addressables' started by dsavickij, Jan 29, 2020.

  1. dsavickij

    dsavickij

    Joined:
    May 17, 2019
    Posts:
    12
    1. it's still undocumented!!!
    2. it's still non typed, why use template variant? whats the profit of it if you still need to constantly cast?
    second something wrong with it by itself, i have code (executed from menu as menu item so only in editor and not during play):

    Code (CSharp):
    1.  
    2. var myScriptableObject = new MyScriptableObject();
    3. string assetPath = "pathToWhereToSave";
    4. UnityEditor.AssetDatabase.CreateAsset(myScriptableObject, assetPath);
    5. m_SORefference = new AssetReferenceT<MyScriptableObject(UnityEditor.AssetDatabase.AssetPathToGUID(assetPath));
    6. var test = m_SORefference.editorAsset as MyScriptableObject; //returns null, in case of cast throws exception
    7.  
    why is it returning null? i can't see the reason....
     
  2. dsavickij

    dsavickij

    Joined:
    May 17, 2019
    Posts:
    12
    For those interested, seems that issue was because of the missing extension...