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,
public class LocalizationTest : MonoBehaviour {
[SerializeField] private LocalizedString exampleString;
[SerializeField] private LocalizedString anotherString;
void Awake() {
string s = exampleString.GetLocalizedString();
string s2 = anotherString.GetLocalizedString();
}
}
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.
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