当前位置:网站首页>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");
边栏推荐
- String or binary data will be truncated
- Stm32f4 --- general timer update interrupt
- Decryption function calculates "task state and lifecycle management" of asynchronous task capability
- 1500万员工轻松管理,云原生数据库GaussDB让HR办公更高效
- A new path for enterprise mid Platform Construction -- low code platform
- #夏日挑战赛#数据库学霸笔记(下)~
- The mega version model of dall-e MINI has been released and is open for download
- What to do when encountering slow SQL? (next)
- Yyds dry goods inventory # solve the real problem of famous enterprises: maximum difference
- MySQL execution process and sequence
猜你喜欢
Flir Blackfly S 工业相机:通过外部触发实现多摄像头同步拍摄
Centos8 install MySQL 8.0 using yum x
Decryption function calculates "task state and lifecycle management" of asynchronous task capability
强化学习如何用于医学影像?埃默里大学最新《强化学习医学影像分析》综述,阐述最新RL医学影像分析概念、应用、挑战与未来方向
[paper reading | deep reading] dngr:deep neural networks for learning graph representations
3D激光SLAM:Livox激光雷达硬件时间同步
postgresql之整体查询大致过程
Detailed explanation of line segment tree (including tested code implementation)
FLIR blackfly s industrial camera: auto exposure configuration and code
The mega version model of dall-e MINI has been released and is open for download
随机推荐
How do I dump SoapClient requests for debugging- How to dump SoapClient request for debug?
Word wrap when flex exceeds width
遇到慢SQL该怎么办?(下)
Tiflash source code reading (IV) design and implementation analysis of tiflash DDL module
Flir Blackfly S 工业相机:自动曝光配置及代码
String or binary data will be truncated
MetaForce原力元宇宙开发搭建丨佛萨奇2.0系统开发
强化学习如何用于医学影像?埃默里大学最新《强化学习医学影像分析》综述,阐述最新RL医学影像分析概念、应用、挑战与未来方向
Introduction to FLIR blackfly s industrial camera
UC伯克利助理教授Jacob Steinhardt预测AI基准性能:AI在数学等领域的进展比预想要快,但鲁棒性基准性能进展较慢
FLIR blackfly s industrial camera: configure multiple cameras for synchronous shooting
Dall-E Mini的Mega版本模型发布,已开放下载
postgresql之整體查詢大致過程
阿里云易立:云原生如何破解企业降本提效难题?
张平安:加快云上数字创新,共建产业智慧生态
3D laser slam: time synchronization of livox lidar hardware
激光雷达:Ouster OS产品介绍及使用方法
Livox激光雷达硬件时间同步---PPS方法
企业中台建设新路径——低代码平台
一片叶子两三万?植物消费爆火背后的“阳谋”