当前位置:网站首页>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");
边栏推荐
- How do I dump SoapClient requests for debugging- How to dump SoapClient request for debug?
- Twenty or thirty thousand a leaf? "Yang Mou" behind the explosion of plant consumption
- 1500万员工轻松管理,云原生数据库GaussDB让HR办公更高效
- Time synchronization of livox lidar hardware -- PPS method
- 建議收藏!!Flutter狀態管理插件哪家强?請看島上碼農的排行榜!
- SchedulX V1.4.0及SaaS版发布,免费体验降本增效高级功能!
- 组合导航:中海达iNAV2产品描述及接口描述
- Lumion 11.0 software installation package download and installation tutorial
- Why am I warned that the 'CMAKE_ TOOLCHAIN_ FILE' variable is not used by the project?
- 【森城市】GIS数据漫谈(二)
猜你喜欢
低代码平台中的数据连接方式(上)
The last line of defense of cloud primary mixing department: node waterline design
Introduction to FLIR blackfly s industrial camera
处理streamlit库上传的图片文件
Robot team learning method to achieve 8.8 times human return
云原生混部最后一道防线:节点水位线设计
压缩 js 代码就用 terser
Lumion 11.0软件安装包下载及安装教程
人脸识别应用解析
Stm32f4 --- general timer update interrupt
随机推荐
Treadpoolconfig thread pool configuration in real projects
XML to map tool class xmlmaputils (tool class V)
pgpool-II和pgpoolAdmin的使用
[server data recovery] data recovery case of a Dell server crash caused by raid damage
Several classes and functions that must be clarified when using Ceres to slam
建議收藏!!Flutter狀態管理插件哪家强?請看島上碼農的排行榜!
leetcode:736. Lisp 语法解析【花里胡哨 + 栈 + 状态enumaotu + slots】
[paper reading | deep reading] graphsage:inductive representation learning on large graphs
postgresql之integerset
【Unity】升级版·Excel数据解析,自动创建对应C#类,自动创建ScriptableObject生成类,自动序列化Asset文件
张平安:加快云上数字创新,共建产业智慧生态
Redis configuration class redisconfig
The last line of defense of cloud primary mixing department: node waterline design
Data connection mode in low code platform (Part 1)
压缩 js 代码就用 terser
Lumion 11.0 software installation package download and installation tutorial
Seconds understand the delay and timing function of wechat applet
一片叶子两三万?植物消费爆火背后的“阳谋”
Chang'an chain learning notes - certificate model of certificate research
激光雷达:Ouster OS产品介绍及使用方法