关于转义字符的处理

在Unity脚本中可以直接使用带有“\n”转义字符(escape character)的字符串,使得字符串能够在GUI中显示换行。

如果配置或服务器发送的字符串里面包含“\\n”,需要处理替换为“\n”

System.Text.RegularExpressions.Regex.Unescape(text);

 

参考:https://answers.unity.com/questions/138464/how-to-make-a-line-break-in-a-gui-label.html

参考:https://blog.csdn.net/YouyoMei/article/details/88715593

posted @ 2022-04-09 10:52  何文西  阅读(286)  评论(0编辑  收藏  举报