Changes to formattedText made in OnConversationLine get overwritten by localization

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
aki.kanerva
Posts: 3
Joined: Wed Apr 23, 2025 9:19 am

Changes to formattedText made in OnConversationLine get overwritten by localization

Post 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?
User avatar
Tony Li
Posts: 23250
Joined: Thu Jul 18, 2013 1:27 pm

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

Post 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.
aki.kanerva
Posts: 3
Joined: Wed Apr 23, 2025 9:19 am

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

Post 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.
User avatar
Tony Li
Posts: 23250
Joined: Thu Jul 18, 2013 1:27 pm

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

Post 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).
aki.kanerva
Posts: 3
Joined: Wed Apr 23, 2025 9:19 am

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

Post by aki.kanerva »

Confirming that the subclassing method worked and this issue is resolved.
User avatar
Tony Li
Posts: 23250
Joined: Thu Jul 18, 2013 1:27 pm

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

Post by Tony Li »

Great! Thanks for the confirmation.
Post Reply