Hi!
I'm working on a Menu for a game, and I'm using TextTables and creating some scripts that converts text in (For example) TextMeshPro to the table field value, if match any.
That works okay, the trouble is, that I'd like to make this little scripts subscribe to some kind of Event, to detect when the user changes the language. That way, I would re-retrieve the values of the field with the new language.
Can I subscribe to an event that is fired when the language is changed? Is there such event? (And also, if i'm over complicating creating this scripts let me know!)
Event to detect when language changes
Re: Event to detect when language changes
Hi,
If you make your script a subclass of the Dialogue System's LocalizeUI class, its UpdateText() method will be called whenever the language changes.
In the case of your script, you can just use LocalizeUI directly without having to write any scripts. It localizes TextMeshProUGUI and UI.Text components.
If you make your script a subclass of the Dialogue System's LocalizeUI class, its UpdateText() method will be called whenever the language changes.
In the case of your script, you can just use LocalizeUI directly without having to write any scripts. It localizes TextMeshProUGUI and UI.Text components.
Re: Event to detect when language changes
Ohh, alright so just by using LocalizeUI it will work (I just tested, worked at once!)
In the future, if I have another UI component that isn't a text or TextMeshPro (Which would be rare, now thinking about it) I should extend from LocalizeUI and then override UpdateText method, right?
Thanks Tony
In the future, if I have another UI component that isn't a text or TextMeshPro (Which would be rare, now thinking about it) I should extend from LocalizeUI and then override UpdateText method, right?
Thanks Tony
Re: Event to detect when language changes
Hi,
Yes. That's all you need to do.
Yes. That's all you need to do.