Search Unity

Question "The given key was not present in the dictionary" Error when building Addressables Groups

Discussion in 'Addressables' started by kk3hi3123, Sep 29, 2021.

  1. kk3hi3123

    kk3hi3123

    Joined:
    Aug 17, 2016
    Posts:
    31
    I am using Unity 2019.4.21f1 and Addressables 1.19.4.
    When I try to build the addressables groups, "The given key was not present in the dictionary" comes out.

    upload_2021-9-29_13-49-49.png

    It looks like that Unity fails to build catalog file as the bundle files are generated in the build path.

    And here is the detail log in Editor.log.
    Code (CSharp):
    1. The given key was not present in the dictionary.
    2. UnityEngine.StackTraceUtility:ExtractStackTrace ()
    3. UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
    4. UnityEngine.Logger:Log (UnityEngine.LogType,object)
    5. UnityEngine.Debug:LogError (object)
    6. UnityEditor.AddressableAssets.Build.DataBuilders.BuildScriptBase:BuildData<UnityEditor.AddressableAssets.Build.AddressablesPlayerBuildResult> (UnityEditor.AddressableAssets.Build.AddressablesDataBuilderInput) (at Library/PackageCache/com.unity.addressables@1.19.4/Editor/Build/DataBuilders/BuildScriptBase.cs:99)
    7. UnityEditor.AddressableAssets.Settings.AddressableAssetSettings:BuildPlayerContentImpl () (at Library/PackageCache/com.unity.addressables@1.19.4/Editor/Settings/AddressableAssetSettings.cs:2529)
    8. UnityEditor.AddressableAssets.Settings.AddressableAssetSettings:BuildPlayerContent (UnityEditor.AddressableAssets.Build.AddressablesPlayerBuildResult&) (at Library/PackageCache/com.unity.addressables@1.19.4/Editor/Settings/AddressableAssetSettings.cs:2500)
    9. UnityEditor.AddressableAssets.Settings.AddressableAssetSettings:BuildPlayerContent () (at Library/PackageCache/com.unity.addressables@1.19.4/Editor/Settings/AddressableAssetSettings.cs:2283)
    10. UnityEditor.AddressableAssets.GUI.AddressableAssetsSettingsGroupEditor:OnBuildPlayerData () (at Library/PackageCache/com.unity.addressables@1.19.4/Editor/GUI/AddressableAssetsSettingsGroupEditor.cs:356)
    11. UnityEditor.AddressableAssets.GUI.AddressableAssetsSettingsGroupEditor:OnBuildScript (object) (at Library/PackageCache/com.unity.addressables@1.19.4/Editor/GUI/AddressableAssetsSettingsGroupEditor.cs:351)
    12. UnityEditor.GenericMenu:CatchMenu (object,string[],int)
    13.  
    14. (Filename: Library/PackageCache/com.unity.addressables@1.19.4/Editor/Build/DataBuilders/BuildScriptBase.cs Line: 99)
    15.  
     
  2. Rotary-Heart

    Rotary-Heart

    Joined:
    Dec 18, 2012
    Posts:
    813
    I got that error before and fixed it by making sure that both my group and schema settings had the correct building and loading path. For some reason my all the paths got deleted and didn't point to anything.
     
  3. kk3hi3123

    kk3hi3123

    Joined:
    Aug 17, 2016
    Posts:
    31
    Thanks for your help! I forget to check the group and schema settings. Some of the path are missing and everything works after assigning the path.
     
    ohthepain likes this.
  4. Wattosan

    Wattosan

    Joined:
    Mar 22, 2013
    Posts:
    460
    I got the same error suddenly and it seems that the group that was missing the Build Path and Load Path was the automatically generated "Duplicate Asset Isolation".
     
  5. plmx

    plmx

    Joined:
    Sep 10, 2015
    Posts:
    308
    To add to this, we had the same issue, but only some of the addressables listed in the Adressables > Groups Window were affected - and not the first ones. So, we had to click on them one by one and restore the correct Build Path and Load Path (which, in our case, were simply "LocalBuildPath" and "LocalLoadPath". After that, however, everything went smoothly.