Search Unity

Bug: Renaming a class causes `InvalidKeyException`

Discussion in 'Addressables' started by JamesFrowenDev, Feb 1, 2020.

  1. JamesFrowenDev

    JamesFrowenDev

    Joined:
    Oct 10, 2015
    Posts:
    20
    Renaming a class (or change its namespace) for a ScriptableObject causes `InvalidKeyException` and the result to be null when using LoadAssetAsync<T>


    Exception encountered in operation UnityEngine.ResourceManagement.ResourceManager+CompletedOperation`1[Namespace.Class], result='', status='Failed': Exception of type 'UnityEngine.AddressableAssets.InvalidKeyException' was thrown., Key=673f4f4c43159e54490348062492ae3f, Type=Namespace.Class


    Seems to be a problem with the `m_mainAssetType` field not updating in the AssetGroups when a class is renamed.


    A work around for this error seems to be manually updating the `m_mainAssetType`.

    Unticking and reticking the `Addressable` box on the asset updates the `m_mainAssetType` field which then allows the asset to load without the exception.
     
    Last edited: Feb 1, 2020
  2. davidla_unity

    davidla_unity

    Unity Technologies

    Joined:
    Nov 17, 2016
    Posts:
    763
    Good call, I'll get a ticket added internally to look into this.
     
  3. unity_bill

    unity_bill

    Joined:
    Apr 11, 2017
    Posts:
    1,053
    We've fixed this in our repo. The fix should be in our 1.8.x build in the coming weeks.
     
    JamesFrowenDev likes this.