Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question Localize String Event not happening on Start

Discussion in 'Localization Tools' started by mattimus, Jul 22, 2023.

  1. mattimus

    mattimus

    Joined:
    Mar 8, 2008
    Posts:
    576
    I've created an empty scene, added a TextMeshPro object, and put a Localize String Event component on it. I linked the Update String to be the Text field on the TMP component. A super basic setup.

    upload_2023-7-21_18-6-14.png

    But when I hit play, the string shows the default text.

    However in the Inspector I can toggle any checkbox on the Localize String Event component and the text updates to be the correct text. Or if I pick a different Locale in the top right corner of the game window the string also updates.

    Why does the string not show the localized value on Start? What am I missing to get it to show the correct value on Start?

    Unity 2019.4.39, latest version of the Localization package (1.4.3)
     
  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    7,820
    Does the text in the inspector for the TMP component update?
    Try right clicking the TMP component and picking localize, it will automatically setup the LocalizedStringEvent component.
    We also have 1.4.4 as our latest version now.
     
  3. mattimus

    mattimus

    Joined:
    Mar 8, 2008
    Posts:
    576
    I updated to 1.4.4 and that did not affect the issue.

    I duplicated the TMP object, removed the manually added Localize String Event component, and added a new one through Right Click-> Localize. The duplicate one worked correctly. I looked through the differences, and the auto created one had the Update String event set to Editor And Runtime whereas the manually created one was only Runtime Only. If I set the auto one to Runtime Only, it has the same behavior of not updating until I toggle a property on the Localize String Event component.

    So I got the issue resolved by setting the event to Editor And Runtime, but it seems there is a bug with the Localized String Event script not getting initialized correctly upon entering play mode when the action is set to Runtime Only. I made a build, and both the manual and the auto created objects work correctly, so the issue is only limited to play mode in the editor.
     
  4. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    7,820
    Hmm that sounds strange. Could you please file a bug report so we can look into it?