Search Unity

Question How to Make LocalizeStringEvent run on start only

Discussion in 'Localization Tools' started by Stanley_DBI, Nov 24, 2022.

  1. Stanley_DBI

    Stanley_DBI

    Joined:
    Feb 18, 2022
    Posts:
    17
    So I just found out that LocalizeStringEvent runs every time the object is enabled. So in my game, I have an inventory slot which is empty when you start playing. I put LocalizeStringEvent here so when it's empty it shows "No equipment" text based on which language is selected. Now when the character equips an item, it changes the "No equipment" text to the item's name with LocalizedString.GetLocalizedStringAsync().Result. The problem is every time the player closes & re-open the equipment tab, the text changes back to "No equipment".

    Can someone help me solve this issue?
     
  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,291
    Can you disable the component when you don't need it and then reenable it when you do?
     
  3. Stanley_DBI

    Stanley_DBI

    Joined:
    Feb 18, 2022
    Posts:
    17
    Ok it works at the moment. Thanks for your help.
     
    karl_jones likes this.