Search Unity

ArgumentException: Default Index is beyond the scope of possible value

Discussion in 'Localization Tools' started by Exentro, Apr 28, 2020.

  1. Exentro

    Exentro

    Joined:
    Oct 8, 2013
    Posts:
    36
    I am getting this error at startup (sometimes, not always, no sure why/when its triggered) , any idea how I can fix it ? I am still playing a bit with the package so maybe I broke something by creating/deleting files.

    Code (CSharp):
    1. ArgumentException: Default Index  is beyond the scope of possible value
    2. UnityEditor.UIElements.PopupField`1[T]..ctor (System.String label, System.Collections.Generic.List`1[T] choices, System.Int32 defaultIndex, System.Func`2[T,TResult] formatSelectedValueCallback, System.Func`2[T,TResult] formatListItemCallback) (at <3e481e8f36eb4d4c8d94b9ba6b2be438>:0)
    3. UnityEditor.UIElements.PopupField`1[T]..ctor (System.Collections.Generic.List`1[T] choices, System.Int32 defaultIndex, System.Func`2[T,TResult] formatSelectedValueCallback, System.Func`2[T,TResult] formatListItemCallback) (at <3e481e8f36eb4d4c8d94b9ba6b2be438>:0)
    4. UnityEditor.Localization.UI.GameViewLanguageMenu..ctor () (at Library/PackageCache/com.unity.localization@0.6.1-preview/Editor/UI/GameViewLanguageMenu.cs:29)
    5. UnityEditor.Localization.UI.GameViewLanguageMenu.AddToolbarsToGameViews () (at Library/PackageCache/com.unity.localization@0.6.1-preview/Editor/UI/GameViewLanguageMenu.cs:104)
    6. UnityEditor.Localization.UI.GameViewLanguageMenu.Show () (at Library/PackageCache/com.unity.localization@0.6.1-preview/Editor/UI/GameViewLanguageMenu.cs:50)
    7. UnityEditor.Localization.UI.GameViewLanguageMenu.PlayModeStateChanged (UnityEditor.PlayModeStateChange obj) (at Library/PackageCache/com.unity.localization@0.6.1-preview/Editor/UI/GameViewLanguageMenu.cs:72)
    8. UnityEditor.EditorApplication.Internal_PlayModeStateChanged (UnityEditor.PlayModeStateChange state) (at <3e481e8f36eb4d4c8d94b9ba6b2be438>:0)
     
    Only4gamers likes this.
  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,279
    Looks like it could be caused when the project has no locales. Do you have any in the project?
     
    Only4gamers likes this.
  3. Only4gamers

    Only4gamers

    Joined:
    Nov 8, 2019
    Posts:
    327
    Hello,
    I am getting same error whenever I am trying to access Localization from Edit>Project Setting>Localization.
    And in Localization Window it's not showing anything but Only Localization Title is there. And on Android Build when I am trying to change Language it's showing "No locales available" there in dropdown.

    I am noticing this problem after updating Localization and addressable package to the latest version. In the previous version of localization this problem was not there.
     
  4. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,279
    Thats strange. Could you file a bug report with the broken project so I can see what went wrong?
    To fix it you could try re-importing the Locale assets. If that fails you could delete the AddressableAssetsData directory and then reimporting all the Localization assets.
     
    Only4gamers likes this.
  5. Only4gamers

    Only4gamers

    Joined:
    Nov 8, 2019
    Posts:
    327
    Sorry but I can't upload whole project as its size is 1 GB even without Library folder. How to re-import Locale Assets?
    Thanks
     
  6. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,279
    Right click on the asset and choose reimport.
    Is the project source controlled? Can you see what assets where changed when you upgraded?
     
  7. Only4gamers

    Only4gamers

    Joined:
    Nov 8, 2019
    Posts:
    327
    No, I am not using any version control yet. Instead I copy whole project (Without Library folder) in every two days for backup. Is this any helpful?
     
  8. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,279
    Maybe.
    Can you copy the contents of the AddressableAssetsData directory for both versions and share that?
     
    Only4gamers likes this.
  9. Only4gamers

    Only4gamers

    Joined:
    Nov 8, 2019
    Posts:
    327
    Yes. Here
     

    Attached Files:

    karl_jones likes this.
  10. Only4gamers

    Only4gamers

    Joined:
    Nov 8, 2019
    Posts:
    327
    Hello,
    I tried reimporting but same error coming when reimporting "Localization Settings" file and this file is showing blank in inspector. Problem is related to this file I think.
    Is this possible to restore my previous Localization version? I already have previous version files somewhere in my backup.
     

    Attached Files:

  11. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,279
    Try deleting the localization settings file and then creating it. Most settings are stored in Addressables so you wont lose any Localization data.
     
    Only4gamers likes this.
  12. Only4gamers

    Only4gamers

    Joined:
    Nov 8, 2019
    Posts:
    327
    Actually I succeed to restore my previous version of Localization package. And everything is looking good except in Window>Asset Management>Localization Table it's showing blank with "No Asset Tables found. Please Create One". How to restore my previous tables here.
     
  13. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,279
    That means they are not in Addressables.
    Select the Table Collection asset in the project settings (The one with the name of the table only) and right click and choose reimport. This will fix the Addressables for that collection. Do this for each table collection.
     
    Only4gamers likes this.