Search Unity

Resolved StringTable.GetEntry(entry) is returning null after upgrading to 0.8.1

Discussion in 'Localization Tools' started by bottledgalaxy, Sep 23, 2020.

  1. bottledgalaxy

    bottledgalaxy

    Joined:
    Jul 19, 2019
    Posts:
    85
    I was using 0.7.1 without issues, and I updated to 0.8.1 today and I'm now getting this error:

    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. Nodeshifter.LocalizationHelper.getStringEntry (System.String entry) (at Assets/Scripts/Nodeshifter/LocalizationHelper.cs:70)
    3. OverlayEquipCassettes+<Setup>d__13.MoveNext () (at Assets/Scripts/OverlayEquipCassettes.cs:95)
    4. UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at /Users/bokken/buildslave/unity/build/Runtime/Export/Scripting/Coroutines.cs:17)
    5. UnityEditor.PlayModeView:RenderView(Vector2, Boolean)
    6. Unity.DeviceSimulator.SimulatorWindow:OnGUI() (at Library/PackageCache/com.unity.device-simulator@2.2.3-preview/Editor/SimulatorWindow.cs:134)
    When calling this:

    Code (CSharp):
    1.         public string getStringEntry(string entry)
    2.         {
    3.             if (dbStrings == null) return "NOT_READY";
    4.             return dbStrings.GetEntry(entry).LocalizedValue;
    5.         }
    dbStrings is a StringTable and is correctly showing values when debugging (check attachment)

    Did something change that would break this?
     

    Attached Files:

    Last edited: Sep 23, 2020
  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,297
    Nothing changed that should break things.
    Is this in the editor or player?
    Can you please file a bug report?
    Is the value being passed into GetEntry correct? Did it maybe change?
     
    bottledgalaxy likes this.
  3. bottledgalaxy

    bottledgalaxy

    Joined:
    Jul 19, 2019
    Posts:
    85
    It was my own mistake. Like 99% of bugs.

    I was ONLY checking on a specific part of my game, which hasn't been tested before I made the upgrade. Your comment made me go ahead and test other places which were working fine. So I doubled and tripled checked.

    This new piece was the only piece of entry that had multiple words in it. They key was made by separating those words with an _ and the code was looking for it with a space.

    Thank you for your quick answer like always!
     
    karl_jones likes this.