Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question GetLocalizedString() creates events that never leave Event Viewer

Discussion in 'Localization Tools' started by OneManEscapePlan, Apr 25, 2023.

  1. OneManEscapePlan


    Oct 14, 2015
    Whenever I call `GetLocalizedString()` on a string from a localization table, it seems to create several entries in the Event Viewer that never go away.

    For example,

    Code (CSharp):
    1. public class LocalizationTest : MonoBehaviour {
    2.     [SerializeField] private LocalizedString exampleString;
    3.     [SerializeField] private LocalizedString anotherString;
    5.     void Awake() {
    6.         string s = exampleString.GetLocalizedString();
    7.         string s2 = anotherString.GetLocalizedString();
    8.     }
    9. }
    In this example, once the Awake() function runs, two GetLocalizedStringOperations and (at least) two GetTableEntryOperations will appear in the Event Viewer. These entries remain in the Event Viewer as long as the application is running in the Editor, even after switching to a different scene.

    Localization Event Viewer.png

    Note that the "Locale:" field is blank.

    It does appear that no more than one set of GetLocalizedStringOperation and GetTableEntryOperation will be created for a specific string in the string table. So for example, if we load "MyTable/MyString" with GetLocalizedString(), switch scenes, then load "MyTable/MyString" again, there will still only be one pair of operations for that string in the Event Viewer. But if we load a different string, that creates a new pair of operations that never go away.

    I don't see this behavior mentioned in the LocalizedString documentation and I'm not sure if it's a bug, the intended behavior, or I'm doing something wrong. Is there something we need to do to manually release a string after calling GetLocalizedString()?

    If this sounds like a bug, I'll submit a bug report with simple verification project.

    Tested in Unity 2021.3.21f1 and Unity 2021.3.23f1, with Localization 1.3.2 and Localization 1.4.3
  2. karl_jones


    Unity Technologies

    May 5, 2015