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

Resolved [Case 1305114] InvalidKeyException in fast mode in all versions from 1.16.1 to 1.16.15

Discussion in 'Addressables' started by iamarugin, Jan 10, 2021.

  1. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    861
    1. Open attached project to the case
    2. Press Start
    3. Observe an exception in the console.
    4. Exception says that transformer_substation/transformer_substation_0_8.prefab key is invalid.
    5. Open Addressable Groups. Copy and paste transformer_substation/transformer_substation_0_8.prefab into search field. Observe that asset with this address exists.

    Exception start to appear from Addressables 1.16.1 to latest version.
    Addressables 1.15.1 have no exceptions.
     
    Last edited: Jan 10, 2021
  2. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    861
    Any workaround would be appreciated.
     
  3. TreyK-47

    TreyK-47

    Unity Technologies

    Joined:
    Oct 22, 2019
    Posts:
    1,787
    Thanks for filing the bug report! I'll forward to the team to see if they have a work around to suggest.
     
    iamarugin likes this.
  4. Yuki_Rain

    Yuki_Rain

    Joined:
    Jul 25, 2017
    Posts:
    13
    I have the same problem with you, check the script in com.unity.addressables@1.16.10/Editor/Build/AddressableAssetSettingsLocator.cs
    Code (CSharp):
    1. // AddressableAssetSettingsLocator.cs
    2.  
    3.         string GetInternalIdFromFolderEntry(string keyStr, AddressableAssetEntry entry)
    4.         {
    5.             var entryPath = entry.AssetPath;
    6.             if (keyStr.StartsWith(entry.address + "/"))
    7.                 return keyStr.Replace(entry.address, entryPath);
    8.             foreach (var l in entry.labels)
    9.                 if (keyStr.StartsWith(l + "/"))
    10.                     return keyStr.Replace(l, entryPath);
    11.             return string.Empty;
    12.         }
    13.  
    1.if the address contains folder, this function will be call.
    2.the function is design to replace the entry path to full path.
    3.but it use string.Replace to make it, so for you, for example, if the full path of "transformer_substation" is "Assets/transformer_substation", the result will be "Assets/transformer_substation/Asset/transformer_substation_0_8.prefab", but expected result is "Assets/transformer_substation/transformer_substation_0_8.prefab".

    a simple way to fix it is to rename your entry(folder), to make the folder name not contained in the rest of address, for your example, you can just rename "transformer_substation" to "my_transformer_substation", and the address become "my_transformer_substation/transformer_substation_0_8.prefab", problem solved!

    but to fix this problem completely, we can only expect official member to fix the code here in latest version(use string.indexOf string.Substring but string.Replace)
    hope it is helpful for you, and my post is here https://forum.unity.com/threads/addressable-entry-contains-two-more-same-word-leads-error.1032619/
     
    Last edited: Jan 12, 2021
  5. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    861
    Thanks, for suggestion.
     
  6. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    861
    Btw this error was introduced on September 22.
     
  7. davidla_unity

    davidla_unity

    Unity Technologies

    Joined:
    Nov 17, 2016
    Posts:
    736
    We did just fix an issue in fast mode that sounds very much like this. Try updating to 1.17.0-preview and see if the issue persists.
     
  8. Yuki_Rain

    Yuki_Rain

    Joined:
    Jul 25, 2017
    Posts:
    13
    looks like this bug has been fixed in Addressables 1.17.2-preview:)(not fixed in 1.17.0-preview)
     
    TreyK-47 likes this.
  9. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    861
    It would be great if you will place [Known Issues] somewhere on the forum, so users don't spend days debugging and posting bugs that are already fixed or being investigated.