Page 1 of 1

[Solved] LocalizeUI component disabled query and potential editor bug

Posted: Fri Jun 30, 2023 5:21 pm
by tomb
Hi Tony

I am using using Unity 2021.3.2.f1 and updated the Dialogue System from 2.2.27 to 2.2.38.1 today. I noticed a difference with the LocalizeUI component.

In 2.2.27 when the LocalizeUI component is disabled it will not try to localise the Text Mesh Pro field at runtime.

In 2.2.38.1 the LocalizeUI will try to translate text even when the component is not enabled.

disabled component.png
disabled component.png (9.72 KiB) Viewed 323 times

Is this the intention going forwards? I have this setup on a few menus as when I create temporary buttons I duplicate an old one and disable the LocalizeUI component with the idea that if I am going to keep the button I will set it up with a new field name for the translation later when I am ready. I can adjust how I am working (I am not using it as designed) but I was curious if this is the intended behaviour.

Separate to the above, while I was playing around with the component I think I found a bug.

Potential Bug exiting play mode?

My instinct seeing the temp buttons being localised was to delete the field name - it wouldn't have a reference and so couldn't localise the field. This seemed to work when entering play mode, giving an expected warning log "Text table does not have a field '1. Story Mode'" (I think it tried to use the TMP text value to find a localisation as the field name is blank?)

blank field name.png
blank field name.png (17.81 KiB) Viewed 323 times

However on exiting play mode the TMP text for that field in the editor was replaced with the first entry from the text table the LocalizeUI component was trying to access. It took me a moment to work out what was happening but I was able to repeat this, I had 3 instances of a button like this (disabled LocalizeUI component with a blank field name) and all 3 had the TMP text replaced with the text from the first entry in the linked text table when returning to the editor from play mode.

text replaced.png
text replaced.png (156.98 KiB) Viewed 323 times
I do not think this is destructive as I tested saving the scene after exiting play mode (while all buttons had been changed to "New Game" in the editor). When I closed and reopened the scene the text reverted to the correct values (Story Mode, Hotel etc). It looks like something is going on though as I would not expect these values to be changed in the editor after play mode.

I did some more testing and it seems like any text that has a localisation applied during play mode (even if an entry is found and applied from a text table) is kept when returning to the editor. For example, I changed the language to French and on returning to the editor all text that was changed with the LocalizeUI component was still in French in the editor after exiting play mode. This was again not destructive and closing/reopening the scene reverted the values to normal.

Also, if the bug has occurred with the altered text visible in the editor after exiting play mode - if you then re-enter play mode then play mode starts with the altered text (e.g. the buttons changed to "New Game" in the editor stay as "New Game" in play mode). This is still not destructive and once again reverts to the original values after closing/reopening the scene, even if you have saved it in this state.

Re: LocalizeUI component disabled query and potential editor bug

Posted: Fri Jun 30, 2023 7:04 pm
by Tony Li
Hi,

I think one answer should address both questions. (If not, let me know.) Inspect the Dialogue Manager's UILocalizationManager component. If it doesn't have a UILocalizationManager component, add one. Then UNtick Also Update Inactive Localize UI.

Re: LocalizeUI component disabled query and potential editor bug

Posted: Wed Jul 05, 2023 6:39 am
by tomb
Hi Tony, thanks for the suggestion.

I didn't previously have a UILocalizationManager as I was using a custom script to save/load the current language rather than the player prefs. I did try adding it, unticking the save in player prefs and "Also Update Inactive Localize UI ".

This has solved both issues I was having - thank you very much!

Re: [Solved] LocalizeUI component disabled query and potential editor bug

Posted: Wed Jul 05, 2023 9:24 am
by Tony Li
Glad to help!