Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

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

Discussion in 'Localization Tools' started by JuanGuzmanH, Oct 20, 2023.

  1. JuanGuzmanH

    JuanGuzmanH

    Joined:
    Feb 8, 2018
    Posts:
    73
    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
    Code (CSharp):
    1.  
    2. IEnumerator LoadMyMessages()
    3.     {
    4.  
    5.         var loadingOperation = LocalizationSettings.StringDatabase.GetTableAsync(my_table_name);
    6.         yield return loadingOperation;
    7.         Log("loading operation finished");
    8.         if (loadingOperation.Status == AsyncOperationStatus.Succeeded)
    9.         {
    10.             Log("LoadIntroMessages...Succeeded");
    11.             var stringTable = loadingOperation.Result;
    12. //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?
     
    Last edited: Oct 20, 2023
  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,142
    JuanGuzmanH likes this.
  3. JuanGuzmanH

    JuanGuzmanH

    Joined:
    Feb 8, 2018
    Posts:
    73
    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.
     
  4. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,142
    Can you share the full editor log from Android?
     
  5. JuanGuzmanH

    JuanGuzmanH

    Joined:
    Feb 8, 2018
    Posts:
    73
    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?
     
  6. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,142
    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
     
  7. JuanGuzmanH

    JuanGuzmanH

    Joined:
    Feb 8, 2018
    Posts:
    73
    New Incident created: IN-58093
     
    karl_jones likes this.
  8. JuanGuzmanH

    JuanGuzmanH

    Joined:
    Feb 8, 2018
    Posts:
    73
    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.
     
  9. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,142
    That is strange, I think QA were struggling to reproduce the issue. Ill add a task for us to look into it instead.
     
    JuanGuzmanH likes this.