LocalizationSettings.InitializationOperation never completes

When calling LocalizationSettings.InitializationOperation.WaitForCompletion(); during runtime build the game freezes on Meta Quest 3. I don’t have any problem when running in the editor.

I’ve tried many variations to LocalizationSettings.InitializationOperation like awaiting the async operation but those operations never complete.

I’ve tried with a test setup using several strings on a test project and I’ve no problem there. What could be the problem? Neither my string table nor asset table are set to preloaded.
Could it be a performance issue because each language’s asset table is about 90Mb? → Tested with smaller asset table (~1.7Mb) and it still freezes.

Unity: 2021.2.13
Localization: 1.5.3

Do you get any errors in the log?
Does it work if you dont call WaitForCompletion?
Can you yield and wait for it to complete asynchronously instead?
If you change the addressables playmode to Use Existing Build do you have the same problem in the Editor?

Hi @karl_jones , thank’s for your reply!

I did a few more tests, here are my findings:

  • I do not get any errors in the log. The application simply freezes.
  • I was able to replicate this behaviour in the editor by changing the addressable playmode to Use Existing Build.
  • When I make a coroutine with ‘yield return LocalizationSettings.InitializationOperation’ and run that coroutine using StartCoroutine it never finishes. However, by chance I also tested it out by making the Start function into a coroutine and then it did work!

Any suggestions?

When do you run the initialization operation? I know some platforms, such as WebGL have issues with it running too soon and can have threading issues that cause a lock. We disabled early initialization for this reason but its possible to cause it if you are manually calling InitializationOperation.
Do you need to call InitializationOperation? It should be triggered automatically when its needed.

I was able to do some more testing and I think I’ve tracked down what the issue is. In the same script where I handle the LocalizationSettings calls I also load the next scene Async using
_loadSceneOperation = SceneManager.LoadSceneAsync(scene.SceneName, LoadSceneMode.Single); _loadSceneOperation.allowSceneActivation = false;.
If I make any calls to LocalizationSettings after those lines and before I reactivate the allowSceneActivation the application freezes.

That might explain why it was working at Start, but not afterward (I was calling it while _loadSceneOperation was still active). Can there only be one active AsyncOperation?

This sounds like this bug Unity Issue Tracker - [Player] Locale does not change when another scene is loading asynchronously
Unfortunately it could not be fixed. I would stick to doing the initialization in Start.