Search Unity

Question Localized translations are sticky in the screen and Issue with Inspector LocalizedStrings.

Discussion in 'Localization Tools' started by iLoveGamesDeveloper, Mar 14, 2023.

  1. iLoveGamesDeveloper

    iLoveGamesDeveloper

    Joined:
    Aug 8, 2019
    Posts:
    14
    Hello, I'm testing the Unity Localization to see if its worth it for me to move from I2. However, I've found two issues which I have not seen others encountered and I have not found a way yet of solving them.

    First one: When I play in the Editor, the screen seems to retain the previous values and everything starts getting sticky. Here is a video:
    https://imgur.com/a/TAigZbt

    Second one: From the documentation, it seems that when I have a "LocalizedString" in the inspector, it's supposed to allow me to create and choose existing localized terms. However, I'm only getting the option to add keys and values. Am I doing something wrong?

    upload_2023-3-14_8-52-7.png

    My testing script:
    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.Localization;
    3.  
    4. public class Apples : MonoBehaviour
    5. {
    6.     public int appleCount = 1;
    7.     [SerializeField] LocalizedString stringToChange;
    8.     [SerializeField] LocalizedString stringToAdd;
    9. }
    And lastly two questions, sometimes I want to move around a string component in the scene for position it seems that it just moves around the instance of that language rather than the general object (aka: if I change the language, the object goes back to the previous position). Do I need to keep pressing "None" language, or set to "Not tracking" whenever I want to move localized text around the scene?

    And, do the variables to use smartstrings need to be always public? We don't really have anything public in our game other than methods and properties.

    Thanks a lot!
     
  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,281
    That looks like the camera is not clearing. Do you have a camera and does it have Clear Flags set to clear?

    Something is interfering with the property drawers, I see this a lot when the Odin plugin is used. Try adding an exception so that it does not handle LocalizedString.

    I would either set the language to "None" or disable tracking when not making language-specific changes.You don't need to do both though, just disabling tracking is enough unless the value is already being tracked in which case it will update the existing tracked values.

    If you are using reflection then they do need to be public. There are other ways to pass values in if you dont want them to be public. Wrap them in a different class/struct and pass that in. Use a dictionary or persistent variable source.
     
  3. iLoveGamesDeveloper

    iLoveGamesDeveloper

    Joined:
    Aug 8, 2019
    Posts:
    14
    Thanks a lot Karl for your prompt answer!

    You were right, although I do not have that specific variable, I found one with similar options in the 2D URP project. That issue happens when the Environment => Background Type is set to Skybox. If I change it to Solid Color is gone.

    upload_2023-3-16_6-53-8.png


    Seems like Odin updated this, I grabbed the last update and now is working fine!


    Sounds good. Thinking more about it, most of my concatenation would happen within my scripts rather than on the inspector. I'm using "smart string" and something like "stringToChange.Add("heart", stringToAdd);". That seems to work fine.

    One extra questions regarding features:
    • Is there a way to extract all the unique characters being used in the game for a specific language? That is super useful when creating a static font in TextMeshPro.
    Thanks for your help so far!
     
  4. iLoveGamesDeveloper

    iLoveGamesDeveloper

    Joined:
    Aug 8, 2019
    Posts:
    14
    I found it on the export!

    Thanks again for the help.
     
    karl_jones likes this.