Error loading a table loadingoperation.Result (no callback error when table doesnt exist))

Hi. I have an error happening on Android, on the editor everything works good.

I was just following the example to load localized entries from a table

IEnumerator LoadMyMessages()
    {

        var loadingOperation = LocalizationSettings.StringDatabase.GetTableAsync(my_table_name);
        yield return loadingOperation;
        Log("loading operation finished");
        if (loadingOperation.Status == AsyncOperationStatus.Succeeded)
        {
            Log("LoadIntroMessages...Succeeded");
            var stringTable = loadingOperation.Result;
//Last line fails!!

The code is executed on Unity Editor without problems but on an Android build there is an error when loading Operation.Results. The async answer is “Succeeded”, Im able to see the log line before. The error happens when Operation.Results is accessed.

NullReferenceException: Object reference not set to an instance of an object.
12:22:50.249Unityd__27.MoveNext () [0x00000] in <00000000000000000000000000000000>:0 >at MyLoaderClass+<LoadIntroMessages>d__27.MoveNext () [0x00000] in <00000000000000000000000000000000>:0
12:22:50.249Unity:0 " style="box-sizing: inherit; flex: 1 1 0%; text-wrap: nowrap;">at UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) [0x00000] in <00000000000000000000000000000000>:0

Im using last version 1.4.5 from the localization package and Unity 2021 LTS.

Im doing something wrong?

Did you build the addressable assets for the Android player?
https://docs.unity3d.com/Packages/com.unity.localization@1.4/manual/QuickStartGuideWithVariants.html#preview-and-configure-your-build

1 Like

I Karl, thankyou for your fast response.

I have to say I never had to take care of the addressables using the default settings from the localiation packages. Even now, I can make builds for android and they work as expected. I have a language selection screen, and all my UI text compoenents are localized acordingly to the selected language, but they are using the string event provided by default.

The error happened just in my effort to read StringDatabase knowing previously the table name.

After your suggestion, I was checking and building manually the addressables to be loaded as local, I made a new Android build but nothing has changed and the error persist.

Can you share the full editor log from Android?

Thanks Karl. Long story short, there is nothing wrong on the Localization package. It turns out that the name of the table was wrong just on the build.

I made a wrong assumption from the example code, even with a table name that doenst exists, the async response “AsyncOperationStatus.Succeeded”.

Is that the expected behaviour?

If yes, I want to make the script error safe, it comes a question…

Is there a way without using try catch to know if “loadingOperation.Result” will fail?

Oh that’s strange. If the table does not exist then it should fail with an error. Could you please file a bug report so we can look into it? https://unity3d.com/unity/qa/bug-reporting

New Incident created: IN-58093

1 Like

Im not sure why but the reported issue has been tagged as not qualified and closed. They say if I still continue with this this issue to come back and reopen… but im not going to invest more time on this.

Just for those people with the same issue… if you ask for a table name that doesnt exist dont wait for an error in the callback.

That is strange, I think QA were struggling to reproduce the issue. Ill add a task for us to look into it instead.

1 Like