Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Error on Play for scene

Discussion in 'Localization Tools' started by alexanderFabula, Jul 23, 2021.

  1. alexanderFabula

    alexanderFabula

    Joined:
    Sep 1, 2019
    Posts:
    22
    I get this error when i press play on a scene with only one textmeshpro object which is localized using the LocalizeStringEvent.


    System.Exception: SelectedLocale is null
    UnityEngine.Localization.Components.LocalizeStringEvent:OnEnable () (at Library/PackageCache/com.unity.localization@1.0.0-pre.10/Runtime/Component Localizers/LocalizeStringEvent.cs:81)

    I also get this:


    OperationException : SelectedLocale is null

    UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1/<>c__DisplayClass57_0<UnityEngine.Localization.Tables.StringTable>:<add_CompletedTypeless>b__0 (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle`1<UnityEngine.Localization.Tables.StringTable>)
    DelegateList`1<UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle`1<UnityEngine.Localization.Tables.StringTable>>:Invoke (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle`1<UnityEngine.Localization.Tables.StringTable>) (at Library/PackageCache/com.unity.addressables@1.18.11/Runtime/ResourceManager/Util/DelegateList.cs:69)
    UnityEngine.Localization.Components.LocalizeStringEvent:OnEnable () (at Library/PackageCache/com.unity.localization@1.0.0-pre.10/Runtime/Component Localizers/LocalizeStringEvent.cs:81)
     
  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,227
    Cold you try running the Addressables locale analyzer. Its in the addressables window.
     
  3. denis_bogdanov

    denis_bogdanov

    Joined:
    Apr 20, 2015
    Posts:
    140
    Hello
    i solved this problem for myself like this
    Window>Asset Management>Localization Scene Controls>Active Locale> Changed from "None" to "English"
     
    tknippenberg and bramd91 like this.
  4. denis_bogdanov

    denis_bogdanov

    Joined:
    Apr 20, 2015
    Posts:
    140

    why do you need a field "Project Locale Identifier"?
    It has no effect.
     

    Attached Files:

  5. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,227
    denis_bogdanov likes this.
  6. Vlad0sZ

    Vlad0sZ

    Joined:
    Apr 9, 2017
    Posts:
    7
    I have some bug, when updated to pre.10
    no error if i disable "wait for completion" in localized string event
     
  7. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,227
    What sort of bug?
    What happens?
    What errors, messages do you get?
     
  8. emadkh

    emadkh

    Joined:
    Aug 23, 2013
    Posts:
    21
    Yes, we encounter this error after updating to Localizaiton pre.10, had to roll it back.


    Code (CSharp):
    1. Exception: Reentering the Update method is not allowed.  This can happen when calling WaitForCompletion on an operation while inside of a callback.
    2. UnityEngine.ResourceManagement.ResourceManager.Update (System.Single unscaledDeltaTime) (at Library/PackageCache/com.unity.addressables@1.18.11/Runtime/ResourceManager/ResourceManager.cs:1054)
    3. UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle`1[TObject].WaitForCompletion () (at Library/PackageCache/com.unity.addressables@1.18.11/Runtime/ResourceManager/AsyncOperations/AsyncOperationHandle.cs:173)
    4. UnityEngine.Localization.LocalizedString.HandleLocaleChange (UnityEngine.Localization.Locale _) (at Library/PackageCache/com.unity.localization@1.0.0-pre.10/Runtime/Localized Reference/LocalizedString.cs:355)
    5. UnityEngine.Localization.LocalizedString.ForceUpdate () (at Library/PackageCache/com.unity.localization@1.0.0-pre.10/Runtime/Localized Reference/LocalizedString.cs:267)
    6. UnityEngine.Localization.LocalizedString.add_StringChanged (UnityEngine.Localization.LocalizedString+ChangeHandler value) (at Library/PackageCache/com.unity.localization@1.0.0-pre.10/Runtime/Localized Reference/LocalizedString.cs:93)
    7. UnityEngine.Localization.Components.LocalizeStringEvent.RegisterChangeHandler () (at Library/PackageCache/com.unity.localization@1.0.0-pre.10/Runtime/Component Localizers/LocalizeStringEvent.cs:125)
    8. UnityEngine.Localization.Components.LocalizeStringEvent.set_StringReference (UnityEngine.Localization.LocalizedString value) (at Library/PackageCache/com.unity.localization@1.0.0-pre.10/Runtime/Component Localizers/LocalizeStringEvent.cs:57)
    This is happening when we set the `LocalizedStringEvent.LocalizedReference` from code, this is set in a call back. previously this wasn't any error, but now it causes error.

    Same for if we set the LocalizedString.StringChange += {} event.
     
  9. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,227
    Could you please file a bug report?
    This is an issue with Addressables. If you call WaitForCompletion inside of an Adressables callback this will occur.
     
  10. emadkh

    emadkh

    Joined:
    Aug 23, 2013
    Posts:
    21
    Hi Karl,

    I actually know about that, and it looks like a valid error by addressable according to this post.
    https://forum.unity.com/threads/eve...when-trying-to-use-waitforcompletion.1125359/

    But the thing is this wasn't happening on the previuse version of Localization pre.9, and we haven't updated addressable since. Our addressable was "1.18.11" before and after update to new localization version.

    Something has changed with localization code behaviour.
     
  11. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,227
    Could you file a bug report so we can see what has changed with your use case?
    We have made some changes to initialization to prevent this issue, can you try enabling the Initialize Synchronously option in the Localization Settings?
     
  12. emadkh

    emadkh

    Joined:
    Aug 23, 2013
    Posts:
    21
    sure, I will try a bug report with a simple example project.

    Also i'll test the Initialize Synchronously option and keep you posted about the result.
     
    karl_jones likes this.
  13. emadkh

    emadkh

    Joined:
    Aug 23, 2013
    Posts:
    21
    [Update] Enabling Initialize Synchronously on LocalizationSettings didn't solve the problem.
     
    Vlad0sZ likes this.