Search Unity

Question NRE during ResetState and PreloadOperation in play mode

Discussion in 'Localization Tools' started by YTFGames, Jul 26, 2021.

  1. YTFGames

    YTFGames

    Joined:
    Nov 27, 2018
    Posts:
    8
    Hi, we started using Localization (1.0.0-per.9) for our app name just recently. Unity Version: 2019.4.9f1.
    I've noticed there're always two null reference exceptions when I launch the game in play mode.
    One on ResetState when disabling the LocalizationSettings
    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. UnityEngine.Localization.Settings.LocalesProvider.ResetState () (at Library/PackageCache/com.unity.localization@1.0.0-pre.9/Runtime/Settings/LocalesProvider.cs:133)
    3. UnityEngine.Localization.Settings.LocalizationSettings.ResetState () (at Library/PackageCache/com.unity.localization@1.0.0-pre.9/Runtime/Settings/LocalizationSettings.cs:485)
    4. UnityEngine.Localization.Settings.LocalizationSettings.OnDisable () (at Library/PackageCache/com.unity.localization@1.0.0-pre.9/Runtime/Settings/LocalizationSettings.cs:181)
    5.  
    One during the preload operation:
    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. UnityEngine.Localization.PreloadDatabaseOperation`2[TTable,TEntry].BeginPreloading () (at Library/PackageCache/com.unity.localization@1.0.0-pre.9/Runtime/Operations/PreloadDatabaseOperation.cs:51)
    3. UnityEngine.Localization.PreloadDatabaseOperation`2[TTable,TEntry].Execute () (at Library/PackageCache/com.unity.localization@1.0.0-pre.9/Runtime/Operations/PreloadDatabaseOperation.cs:42)
    4. UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1[TObject].InvokeExecute () (at Library/PackageCache/com.unity.addressables@1.18.2/Runtime/ResourceManager/AsyncOperations/AsyncOperationBase.cs:549)
    5. UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1[TObject].Start (UnityEngine.ResourceManagement.ResourceManager rm, UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle dependency, DelegateList`1[T] updateCallbacks) (at Library/PackageCache/com.unity.addressables@1.18.2/Runtime/ResourceManager/AsyncOperations/AsyncOperationBase.cs:544)
    6. UnityEngine.ResourceManagement.ResourceManager.StartOperation[TObject] (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1[TObject] operation, UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle dependency) (at Library/PackageCache/com.unity.addressables@1.18.2/Runtime/ResourceManager/ResourceManager.cs:440)
    7. UnityEngine.Localization.Settings.LocalizedDatabase`2[TTable,TEntry].get_PreloadOperation () (at Library/PackageCache/com.unity.localization@1.0.0-pre.9/Runtime/Settings/Database/LocalizedDatabase.cs:81)
    8. UnityEngine.Localization.InitializationOperation.PreloadTables () (at Library/PackageCache/com.unity.localization@1.0.0-pre.9/Runtime/Operations/InitializationOperation.cs:62)
    9. UnityEngine.Localization.InitializationOperation.<LoadLocales>b__10_0 (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle`1[TObject] async) (at Library/PackageCache/com.unity.localization@1.0.0-pre.9/Runtime/Operations/InitializationOperation.cs:50)
    10. DelegateList`1[T].Invoke (T res) (at Library/PackageCache/com.unity.addressables@1.18.2/Runtime/ResourceManager/Util/DelegateList.cs:69)
    11. UnityEngine.Debug:LogException(Exception)
    12. DelegateList`1:Invoke(AsyncOperationHandle`1) (at Library/PackageCache/com.unity.addressables@1.18.2/Runtime/ResourceManager/Util/DelegateList.cs:73)
    13. UnityEngine.ResourceManagement.ChainOperationTypelessDepedency`1:OnWrappedCompleted(AsyncOperationHandle`1)
    14. DelegateList`1:Invoke(AsyncOperationHandle`1) (at Library/PackageCache/com.unity.addressables@1.18.2/Runtime/ResourceManager/Util/DelegateList.cs:69)
    15. UnityEngine.ResourceManagement.ResourceManager:Update(Single)
    16. MonoBehaviourCallbackHooks:Update() (at Library/PackageCache/com.unity.addressables@1.18.2/Runtime/ResourceManager/Util/MonoBehaviourCallbackHooks.cs:26)
    These exceptions probably only happens in Editor since I don't see these in my Android build, but it's pretty annoying and worrying see these every time I press Play in the Editor.

    I've also tried Analyze in the Addressable and there are no apparent issues:
    upload_2021-7-26_11-46-33.png

    I'm wondering if there's an easy fix for this issue or if there's a way to strip/disable the runtime executions since we're only using this for our app name localization and not in game at all (it's handled by our own localization system)

    Thanks!
     

    Attached Files:

  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,300
    Do these errors still happen in 1.0.0-pre.10?
    If they do could you please file a bug report?
     
  3. YTFGames

    YTFGames

    Joined:
    Nov 27, 2018
    Posts:
    8
    Still does, will do.
    Is there a way to strip/disable the runtime executions since we're only using this for our app name localization and not in game at all (it's handled by our own localization system)?
     
  4. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,300
    No you can't disable it. Could you please file a bug report so we can look into it?
    Could you also try updating to the latest version of Unity as this looks like an old bug with serializereference that should be fixed now.
     
    Last edited: Jul 27, 2021
  5. YTFGames

    YTFGames

    Joined:
    Nov 27, 2018
    Posts:
    8
    karl_jones likes this.