Search Unity

Question Cannot implicitly cast type "UnityEngine.Localization.LocalizedString" to "String"

Discussion in 'Localization Tools' started by Fganzi424, Feb 7, 2023.

  1. Fganzi424

    Fganzi424

    Joined:
    Aug 31, 2022
    Posts:
    2
    Hi! I'm making a text randomizer for some loading screens, for this I need to be able to convert a LocalizedString into a String, I've searched everywhere and I can't find a way to do it, maybe I'm an idiot for not finding how to do it, please help!
     
  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,282
  3. Fganzi424

    Fganzi424

    Joined:
    Aug 31, 2022
    Posts:
    2
    when I do the following, the name of the table is output but not its content
    public Text displaytext;
    public LocalizedString names;

    private void Awake()
    {
    displaytext.text = "" + names;
    }
    Sorry for my insistence or ignorance, but why doesn't this work? and how would i make it work
     
  4. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,282
    You need to do
    names.GetLocalizedString()
     
    Fganzi424 likes this.