当前位置:网站首页>Untiy文本框的代码换行问题
Untiy文本框的代码换行问题
2022-07-06 18:43:00 【吴梓穆】
如果是我们主动指定换行,我们可以使用\n来换行
例如
infoText.text = "id:" + monitor.id + "\n" +
"cameraType:" + monitor.cameraType + "\n" +
"workshopName:" + monitor.workshopName+ "\n" +
"camerasIP:" + monitor.camerasIp + "\n" +
"camerasUser:" + monitor.camerasUser + "\n" +
"camerasPwd:" + monitor.camerasPwd + "\n" +
"camerasPort:" + monitor.camerasPort + "\n" +
"monitorName:" + monitor.monitorName+"\n"+
"region:"+monitor.region+"\n"+
"code:"+monitor.code
如果文字内容来自别处,比如从服务器下载,如果文字里自带 \n换行,直接把文字放进text里,\n会被识别为字符,而不会换行,这时因为Untiy非常好心的帮我们自动吧 \n替换为\n了(尽管你很确定你拿到的数据就是\n),所以我们要手动把\n替换为\n,防止被转义
例如
BookRequestResult bookResult = JsonConvert.DeserializeObject<BookRequestResult>(request.downloadHandler.text);
contentText.text = bookResult.data.book;
contentText.text = contentText.text.Replace("\\n","\n");
contentText.text = contentText.text.Replace("\\r","\r");
边栏推荐
- Halcon knowledge: segment_ contours_ XLD operator
- Decryption function calculates "task state and lifecycle management" of asynchronous task capability
- 投资的再思考
- Yyds dry goods inventory # solve the real problem of famous enterprises: maximum difference
- 3D激光SLAM:Livox激光雷达硬件时间同步
- Halcon实例转OpenCvSharp(C# OpenCV)实现--瓶口缺陷检测(附源码)
- The boss is quarantined
- Zhang Ping'an: accelerate cloud digital innovation and jointly build an industrial smart ecosystem
- postgresql 之 数据目录内部结构 简介
- 一片葉子兩三萬?植物消費爆火背後的“陽謀”
猜你喜欢

解密函数计算异步任务能力之「任务的状态及生命周期管理」

UC伯克利助理教授Jacob Steinhardt预测AI基准性能:AI在数学等领域的进展比预想要快,但鲁棒性基准性能进展较慢

Zhang Ping'an: accelerate cloud digital innovation and jointly build an industrial smart ecosystem

Cat recycling bin

使用Ceres进行slam必须要弄清楚的几个类和函数

阿里云易立:云原生如何破解企业降本提效难题?

Collection recommandée!! Quel plug - in de gestion d'état flutter est le plus fort? Regardez le classement des manons de l'île, s'il vous plaît!

Lumion 11.0 software installation package download and installation tutorial

如何从0到1构建32Core树莓派集群

新一代云原生消息队列(一)
随机推荐
TiFlash 源码阅读(四)TiFlash DDL 模块设计及实现分析
Flir Blackfly S USB3 工业相机:白平衡设置方法
Threadlocalutils (tool class IV)
Seconds understand the delay and timing function of wechat applet
Cisp-pte practice explanation (II)
B站6月榜单丨飞瓜数据UP主成长排行榜(哔哩哔哩平台)发布!
Dall-E Mini的Mega版本模型发布,已开放下载
Zabbix 5.0:通过LLD方式自动化监控阿里云RDS
Tiflash source code reading (IV) design and implementation analysis of tiflash DDL module
Flir Blackfly S 工业相机:配置多个摄像头进行同步拍摄
The mega version model of dall-e MINI has been released and is open for download
使用Ceres进行slam必须要弄清楚的几个类和函数
A new path for enterprise mid Platform Construction -- low code platform
1个月增长900w+播放!总结B站顶流恰饭的2个新趋势
红外相机:巨哥红外MAG32产品介绍
Sensor: DS1302 clock chip and driver code
[paper reading | deep reading] rolne: improving the quality of network embedding with structural role proximity
企业中台建设新路径——低代码平台
Web3对法律的需求
Freeswitch dials extension number source code tracking