Page 1 of 1

Changes to formattedText made in OnConversationLine get overwritten by localization

Posted: Wed Apr 23, 2025 9:44 am
by aki.kanerva
Hi there,

We recently upgraded from 2.2.30 to 2.2.51, and our dialogue text post-processing stopped working.

We use I2 Localization, and then modify the localized text in a custom OnConversationLine event by changing subtitle.formattedText.text.

Previously, localization happened before the any custom OnConversationLine events were called. Now, in the latest version, it looks like localization is performed after all OnConversationLine events have finished executing, which means that a) the text passed to our custom code isn't yet localized when it should be and b) any changes made by our custom code are overwritten by the localization.

How do we return to the old execution order? Is there another event that's fired after localization has finished? If not, how can we ensure that our custom code is executed after localization instead of before?

Re: Changes to formattedText made in OnConversationLine get overwritten by localization

Posted: Wed Apr 23, 2025 10:34 am
by Tony Li
Hi,

Unity doesn't guarantee execution order. I recommend making a subclass of DialogueSystemUseI2Language. Override the OnConversationLine() method. After calling the base method (base.OnConversationLine(subtitle)), add your code that modifies subtitle.formattedText.text.

Re: Changes to formattedText made in OnConversationLine get overwritten by localization

Posted: Wed Apr 23, 2025 11:21 am
by aki.kanerva
Thanks for the quick response!

So it was only by chance that it used to work perfectly for two years? Well, glad we discovered this now.

I'll try the subclass implementation, that looks feasible.

Re: Changes to formattedText made in OnConversationLine get overwritten by localization

Posted: Wed Apr 23, 2025 2:09 pm
by Tony Li
Yes, kind of like how multiple scripts with Start() methods generally aren't guaranteed to run their Start() methods in a specific order (unless you manually change the scripts' execution orders).

Re: Changes to formattedText made in OnConversationLine get overwritten by localization

Posted: Thu Apr 24, 2025 1:16 pm
by aki.kanerva
Confirming that the subclassing method worked and this issue is resolved.

Re: Changes to formattedText made in OnConversationLine get overwritten by localization

Posted: Thu Apr 24, 2025 3:03 pm
by Tony Li
Great! Thanks for the confirmation.