Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Enter the 2020.2 Beta Sweepstakes for a chance to win an Oculus Quest 2.
    Dismiss Notice

How to update LocalizeString at runtime

Discussion in 'Localisation Tools Previews' started by default_team, Sep 13, 2020.

  1. default_team

    default_team

    Joined:
    Dec 1, 2018
    Posts:
    17
    I'm updating the string reference of a LocalizeString at runtime. But the UI.Text won't update unless I reset the LocalizationSettings.SelectedLocale.

    Code (CSharp):
    1. setLocalizedStringReference(LocalizedStringReference ref) {
    2.      localizedString.StringReference = ref;
    3.      LocalizationSettings.SelectedLocale = differentLocale;
    4. }
    As shown in the example, I had to set SelectedLocale to a different locale, for the UI.Text to be updated.
    But I want to change the StringReference without having to switch the locale.
     
  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    4,245
    Hey. Could you file a bug report please?
     
  3. default_team

    default_team

    Joined:
    Dec 1, 2018
    Posts:
    17
    Will do. BTW when we change LocalizedString.StringReference does it supposed to update the corresponding UI.Text as well?

    I'm using package 0.3.1 as I'm using Unity 2018.3
     
  4. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    4,245
    Yes, it should update the text. Don't use 0.3.1!!!!
    It's a year old and not at all compatible with the current version.
    You won't be able to upgrade in the future, things have changed a lot.
    Unfortunately, the Localization system just does not support 2018.3. This is because we rely heavily on the 2019.3 SerializeReference feature.
     
    default_team likes this.
unityunity