Hello,
I have a simple question: I am using Unity Localization (0.9.0-preview) and attached a “Localize String Event” to a GameObject X that has a TextMeshPro component.
I also created a little class with just one method:
public class LanguageChangeCallback : MonoBehaviour
{
public void OnLanguageChange(string str) {
Debug.Log(">>str:" + str.ToString());
}
}
I attach this script to GameObject X and set the “Update String” of the “Localize String Event” script to method OnLanguageChange.
When I now run the game and change the language, my method is called, but the passed string “str” is always empty! Anyone knows why?
Is there a value in the table for the current locale?
Can you show a screenshot of the inspector for the localized string and the table editor?
Or just share the project 
Hello karl_jones!
Sorry for the late reply! Here are the screenshots:
Table:
And here is the class I attached to the GameObject with the TextMeshPro:
public class LanguageChangeCallback : MonoBehaviour
{
public void OnLanguageChange(string str) {
Debug.Log(">>str:" + str.ToString());
}
}
When I set the “Update String” to TextMeshPro with Property TextMeshPro.text, the text is updated when I change the language (i.e. via dropdown top right). But when I set my class and “OnLanguageChange”, OnLanguangeChange IS called when I toggle the language, but parameter “str” is always an empty string!
Am I doing something wrong or could this be a bug?
Thanks for any help!
You set the UnityEvent to use a static string instead of the dynamic(localized) one.
When you assign the Update String you need to select from the top of the list, not the bottom

3 Likes
And again you solved my problem!
Damn, I never gave attention to those “dynamic/static paremter” thingys. I guess “static” means thats the values you type in via inspector and dynamic is… created by scripts?
Anyway, you solved my problem. Thanks again!
1 Like