EDIT 2: This seems to be an issue with serialization - if there are more available Locales than a collection currently contains, LocalizationString won’t serialize properly. If I had ‘en’ ‘fr’ and ‘es’ supported, but the collection only has ‘en’ and ‘fr’ tables, then this issue pops up. One can create the table for the collection via the Missing Tables section in the inspector, and the serialization works again.
Hi there, I’ve been poking at the Localization package’s API, and I’m currently trying to (correctly) programmatically create a new Locale and then add it to the Localization system seamlessly (ideally all at edit time for now).
Right now my test code looks like this:
Locale newLocale = Locale.CreateLocale(SystemLanguage.Spanish);
AssetDatabase.CreateAsset(newLocale, "Assets/Localization/" + newLocale.name + " (" + newLocale.Identifier.Code + ").asset");
LocalizationEditorSettings.AddLocale(newLocale);
AssetDatabase.SaveAssets();
I simply want to create and add and have it persist, right. Anyways, when I run this, it seems to create the asset and it’s all showing up properly more or less in the Localization Tables and whatnot - except I’m bombarded with a handful of Null ref exceptions related to some PropertyDrawer things:
Which leads me to believe I’m likely doing something wrong here.
Any wisdom to be shed?
Thank you!
EDIT: This is in 2020.1.6f1 - using Localization v0.8.1