当前位置:网站首页>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");
边栏推荐
- 最近小程序开发记录
- freeswitch拨打分机号源代码跟踪
- Twenty or thirty thousand a leaf? "Yang Mou" behind the explosion of plant consumption
- String or binary data will be truncated
- Input and output of C language pointer to two-dimensional array
- Flir Blackfly S 工业相机:自动曝光配置及代码
- Processus général de requête pour PostgreSQL
- Introduction to microservice architecture
- 建议收藏!!Flutter状态管理插件哪家强?请看岛上码农的排行榜!
- MetaForce原力元宇宙开发搭建丨佛萨奇2.0系统开发
猜你喜欢
随机推荐
本周 火火火火 的开源项目!
Robot team learning method to achieve 8.8 times human return
postgresql 之 数据目录内部结构 简介
【服务器数据恢复】raid损坏导致戴尔某型号服务器崩溃的数据恢复案例
【Unity】升级版·Excel数据解析,自动创建对应C#类,自动创建ScriptableObject生成类,自动序列化Asset文件
[paper reading | deep reading] anrl: attributed network representation learning via deep neural networks
云原生混部最后一道防线:节点水位线设计
15million employees are easy to manage, and the cloud native database gaussdb makes HR office more efficient
【论文阅读|深读】DNGR:Deep Neural Networks for Learning Graph Representations
Lidar: introduction and usage of ouster OS
将截断字符串或二进制数据
Treadpoolconfig thread pool configuration in real projects
张平安:加快云上数字创新,共建产业智慧生态
强化学习如何用于医学影像?埃默里大学最新《强化学习医学影像分析》综述,阐述最新RL医学影像分析概念、应用、挑战与未来方向
【论文阅读|深读】ANRL: Attributed Network Representation Learning via Deep Neural Networks
Processus général de requête pour PostgreSQL
argo workflows源码解析
Web3的先锋兵:虚拟人
Yyds dry goods inventory # solve the real problem of famous enterprises: maximum difference
Word wrap when flex exceeds width









