【问题标题】:Unity3D UI Text string from json not correctly showing来自json的Unity3D UI文本字符串未正确显示
【发布时间】:2015-11-20 06:34:20
【问题描述】:

我从 JSON 中获取字符串并将这个字符串应用到 UI Text.text。

textAZ = jsonObject.GetString("haqqinda_az").ToString();
aboutText.text = textAZ;

但它在游戏窗口中显示 \n 和 \r 符号。我想要这个符号打破新的界限。图片在这里:

image from play mode

【问题讨论】:

    标签: c# json string newline


    【解决方案1】:

    换行符已被转义,但您可以撤消它:

    textAZ = jsonObject.GetString("haqqinda_az").ToString();
    textAZ = textAZ.Replace("\\n","\n").Replace("\\r","\r");
    aboutText.text = textAZ;
    

    【讨论】:

      猜你喜欢
      • 2014-10-11
      • 2019-03-20
      • 1970-01-01
      • 1970-01-01
      • 2021-03-04
      • 1970-01-01
      • 2020-10-20
      • 2015-02-14
      • 2023-03-03
      相关资源
      最近更新 更多