I have a project using Unity Localization. Everything were just fine until I’ve tried to load my scene from another scene by a button. Scene is being loaded correctly but there is no local variable is loaded.
Afterwards when I change Active Locale from “Localization Scene Controls” it’s coming back.
This is an initialization issue. The problem is you are setting the value of year in the Start method however the GameObjectLocalizer also initializes in the Start method, it just happens to execute before your class so when it reads the value it is still empty.
Simplest way to fix this is to change LocalizationController to use Awake instead of Start.
Alternatively, you can also change the order Start is called in ProjectSettings/Script Execution Order.
I could swear that I’ve given a shot for Awake earlier. So I made a little bit investigation and trials.
As far as I can see If I have a text attached with “Localize String Event” the problem occurs still but when I change it to “Game Object Localizer” then there is no problem.
I just want to let you know or I’m making a mistake when I’m using Localize String Event and binding it to text.
It’s a similar issue. LocalizedStringEvent uses OnEnable which is called from Awake. Changing the script execution order to make sure your script runs before the default would be one way to fix it.
Changing the script execution order, putting GameObjectLocalizer before my custom scripts are not enough to prevent the issue. On Start the strings are not yet localized, after that, they are. :think:
This is a different issue. It’s waiting for addressables to initialize and load the data, it doesn’t happen instantly.
You could try yielding on LocalizationSettings.InitializationOperation.
You can also enable the WaitForCompletion option on the LocalizedStrings, this should force it to complete synchronously.