Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Bug Local variables not working in preview mode for loc strings in serializable classes

Discussion in 'Localization Tools' started by cjddmut, Sep 19, 2022.

  1. cjddmut

    cjddmut

    Joined:
    Nov 19, 2012
    Posts:
    179
    It seems fine when playing but local variables don't appear to work correctly in edit mode when previewing smart strings if the localized string is in a serializable class.


    Code (CSharp):
    1. using System;
    2. using UnityEngine;
    3. using UnityEngine.Localization;
    4.  
    5. public class LocStrInSerializableClass : MonoBehaviour
    6. {
    7.     public LocalizedString locStr;
    8.     public MyClass myClass;  // This one doesn't work in when previewing with the inspector
    9.  
    10.     private void Start()
    11.     {
    12.         // Both work fine when we play
    13.         Debug.Log(locStr.GetLocalizedString());
    14.         Debug.Log(myClass.locStr.GetLocalizedString());
    15.     }
    16. }
    17.  
    18. [Serializable]
    19. public class MyClass
    20. {
    21.     public LocalizedString locStr;
    22. }
    upload_2022-9-19_10-22-45.png
    upload_2022-9-19_10-23-23.png

    Localization Version: 1.3.2 (tried with 1.4.0-exp.1 and still a bug)
    Unity Version: 2020.3.17f1
     
    karl_jones likes this.
  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,373