Hello,
I was building a Localization system, and followed this thread to localize the fonts in our texts.
I’ve created texts prefabs with this configuration that I’m using throughout the game:
While it works perfectly in Editor, I’m finding some erratic behaviour in Build.
One thing I have not yet traced is that in some instances, upon starting the game, EVERY SINGLE TEXT appears blank (or default null character). Since I know the menus, I can blindly navigate through to the language settings, and when I change the languages (thus creating a LocalizationEvent call), the text appears again.
This happens sometimes, I couldn’t find why yet. But having this issue or not in a playsession, I have traced another issue when navigating the language settings: I have to navigate through the menu twice for the fonts to be changed accordingly.
SIMPLIFIED EXAMPLE:
- Imagine I have this horizontal scroll to navigate through all my different languages seen in the previous image.
- If my current language is English, I can navigate the menu normally and see languages change.
- When I get to change from Italian to Polish (first lang with a different font) I will not see nor text or fonts change.
- If I go back to Italian and then Polish again, I will see fonts and texts updated correctly.
- This will happen again each time I’m navigating to languages with fonts I have not visited yet.
The stack trace for this error reads the following:
AssertionException: Assertion failure. Value was Null
Expected: Value was not Null
at UnityEngine.Assertions.Assert.Fail (System.String message, System.String userMessage) [0x00043] in <34494dee0a8743c49ad9dc4c9c1f32e6>:0
at UnityEngine.Assertions.Assert.IsNotNull (UnityEngine.Object value, System.String message) [0x00013] in <34494dee0a8743c49ad9dc4c9c1f32e6>:0
at UnityEngine.Assertions.Assert.IsNotNull[T] (T value, System.String message) [0x0001f] in <34494dee0a8743c49ad9dc4c9c1f32e6>:0
at UnityEngine.Assertions.Assert.IsNotNull[T] (T value) [0x00001] in <34494dee0a8743c49ad9dc4c9c1f32e6>:0
at UnityEngine.Localization.Tables.TableEntry.get_SharedEntry () [0x0000f] in C:\...\Library\PackageCache\com.unity.localization@1.0.5\Runtime\Tables\DetailedLocalizationTable.cs:35
at UnityEngine.Localization.GetTableEntryOperation`2[TTable,TEntry].HandleEntryOverride (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle`1[TObject] asyncOperation, TEntry entry) [0x0006f] in C:\...\Library\PackageCache\com.unity.localization@1.0.5\Runtime\Operations\GetTableEntryOperation.cs:87
at UnityEngine.Localization.GetTableEntryOperation`2[TTable,TEntry].ExtractEntryFromTable (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle`1[TObject] asyncOperation) [0x0005e] in C:\...\Library\PackageCache\com.unity.localization@1.0.5\Runtime\Operations\GetTableEntryOperation.cs:64
at UnityEngine.Localization.GetTableEntryOperation`2[TTable,TEntry].Execute () [0x00080] in C:\...\Library\PackageCache\com.unity.localization@1.0.5\Runtime\Operations\GetTableEntryOperation.cs:50
at UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1[TObject].InvokeExecute () [0x00001] in C:\...\Library\PackageCache\com.unity.addressables@1.19.18\Runtime\ResourceManager\AsyncOperations\AsyncOperationBase.cs:474
at UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1[TObject].Start (UnityEngine.ResourceManagement.ResourceManager rm, UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle dependency, DelegateList`1[T] updateCallbacks) [0x000a1] in C:\...\Library\PackageCache\com.unity.addressables@1.19.18\Runtime\ResourceManager\AsyncOperations\AsyncOperationBase.cs:469
at UnityEngine.ResourceManagement.ResourceManager.StartOperation[TObject] (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1[TObject] operation, UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle dependency) [0x00001] in C:\...\Library\PackageCache\com.unity.addressables@1.19.18\Runtime\ResourceManager\ResourceManager.cs:460
at UnityEngine.Localization.Settings.LocalizedDatabase`2[TTable,TEntry].GetTableEntryAsync (UnityEngine.Localization.Tables.TableReference tableReference, UnityEngine.Localization.Tables.TableEntryReference tableEntryReference, UnityEngine.Localization.Locale locale, UnityEngine.Localization.Settings.FallbackBehavior fallbackBehavior) [0x00041] in C:\...\Library\PackageCache\com.unity.localization@1.0.5\Runtime\Settings\Database\LocalizedDatabase.cs:461
at UnityEngine.Localization.Settings.LocalizedAssetDatabase.GetLocalizedAssetAsyncInternal[TObject] (UnityEngine.Localization.Tables.TableReference tableReference, UnityEngine.Localization.Tables.TableEntryReference tableEntryReference, UnityEngine.Localization.Locale locale, UnityEngine.Localization.Settings.FallbackBehavior fallbackBehavior) [0x00001] in C:\...\Library\PackageCache\com.unity.localization@1.0.5\Runtime\Settings\Database\LocalizedAssetDatabase.cs:96
at UnityEngine.Localization.Settings.LocalizedAssetDatabase.GetLocalizedAssetAsync[TObject] (UnityEngine.Localization.Tables.TableReference tableReference, UnityEngine.Localization.Tables.TableEntryReference tableEntryReference, UnityEngine.Localization.Locale locale, UnityEngine.Localization.Settings.FallbackBehavior fallbackBehavior) [0x00001] in C:\...\Library\PackageCache\com.unity.localization@1.0.5\Runtime\Settings\Database\LocalizedAssetDatabase.cs:69
at UnityEngine.Localization.LocalizedAsset`1[TObject].LoadAssetAsync () [0x0000c] in C:\...\Library\PackageCache\com.unity.localization@1.0.5\Runtime\Localized Reference\LocalizedAsset.cs:197
at UnityEngine.Localization.LocalizedAsset`1[TObject].HandleLocaleChange (UnityEngine.Localization.Locale _) [0x00018] in C:\...\Library\PackageCache\com.unity.localization@1.0.5\Runtime\Localized Reference\LocalizedAsset.cs:286
at (wrapper delegate-invoke) System.Action`1[UnityEngine.Localization.Locale].invoke_void_T(UnityEngine.Localization.Locale)
at UnityEngine.Localization.Settings.LocalizationSettings+<InitializeAndCallSelectedLocaleChangedCoroutine>d__72.MoveNext () [0x0004b] in C:\...\Library\PackageCache\com.unity.localization@1.0.5\Runtime\Settings\LocalizationSettings.cs:406
at UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) [0x00026] in <34494dee0a8743c49ad9dc4c9c1f32e6>:0 ```
From which I read that when the system tries to load the locale, it returns null, so the Localization Update Corroutine fails.
But next time, the same locale is not null? How?
I have tried to go through this [solution](https://discussions.unity.com/t/838665) .
Although I'm not familiar with Adressables, it seems that everything is correct in our projects, and rebuilding didn't seem to change anything.
What can I do?
Unity 2021.2.14f1
Localization 1.0.5
Addressables 1.19.18