Tables Preload on 0.9

I flagged the Tables Preload checkbox on some sample tables but they are not loaded and the value of LocalizationSettings.InitializationOperation.IsDone is false and the GetLocalizedString() does not work.
Do I have to call InitializationOperation manually even when the Tables Preload is checked?

The Tables preload during InitializationOperation. This should be started automatically when the game starts but it won’t necessarily be finished when the scene starts.
It sounds like you may need to wait for the operation to finish. What does your code look like?

Hi Karl
I’m simply using GetLocalizedString() on a script attached to a gameobject used by a prefab; this prefab is instantiated in one of the scene of my game (it is the third scene of the game so it should have plenty of time to preload).
I find the table correctly initialized just if the “Locale Game View” is enabled.

thanks for the fast response!

A

Ah this sounds like a bug in the Editor. Could you file a bug report?

1 Like

Filed!

Thanks

1 Like

Regarding the preload not necessarily finishing before the scene starts, is there a way to force it to always load before any of my Awakes so I don’t have to add delay code into every scene I add? I have a bootscene that normally handles it but in testing I load scenes directly and run them and the translation then fails during development.

Hmm i’m not sure. Could you file a bug report with a sample project that shows the problem and ill see if there’s anything we can do.
We do have some Editor support that does this so it may be possible.

Afraid I can’t share the project or have the time. I guess a solution could be if there was a synchronous function that I could call to initialise the tables so they are guaranteeably loaded after it returns. I can then add a component with an early execution order to ensure is always called before others.
But really I’d prefer “Preload all tables” to really mean that! :wink:

Sadly there’s no way to do a synchronous function, its a limitation of the Addressables system.
Ill make a note to look into what we can do, maybe we can do something in the Editor only.

I hope there is a solution as every element that is set from an awake or start is failing for me, and the more I use it the more of these there are and is becoming unworkable. I would take an editor only solution (or any temporary hack) but otherwise may have to abort using this.

How are you setting your values in Start and Awake?
Have you tried using the LocalizedString with the StringChanged event, this will handle the preloading not being completed.

If I understand correctly you do have a boot scene that will initialize the localization settings however you want to be able to enter play mode on any scene and have the preloading completed before Start/Awake etc.
One way to do this is to automate it so that when you enter play mode it first waits for the localization settings to complete initialization before loading the actual scene you pressed play on.

Here is a script that does this, when you use Start and Awake the values will now be ready. Just add it to your project inside of an Editor folder or Editor asmdef.

Does this work for you?

Thanks for the code. In the end there weren’t too many more cases so I put coroutines in the label initialisation so it waits for the translation. Logic is still initialised on the start but in testing the label will update a bit later. Shouldn’t be delayed in the final build.

1 Like