当前位置:网站首页>Ugui uses tips (VI) unity to realize vertical line display of string
Ugui uses tips (VI) unity to realize vertical line display of string
2022-06-28 12:21:00 【Unique_ eight hundred and forty-nine million nine hundred and n】
I have a problem recently , Planning needs , Words are like ancient books , From right to left , Vertical display .
I used to think UGUI Of Text Can meet this demand , I thought I could set a certain property , Change the text displayed horizontally to a vertical line , When you do something, you don't find a native solution , Then I simply raked around the Internet , Two solutions have been found .
The first is , Set to Text The text lines of the component are converted to columns, and the rest are displayed with spaces .
The second is rewriting Text Some functions of the group , I didn't understand how to get it .
Then I tried both methods , There are Bug, Then I used a simple method to replace , Can solve current problems .
I use GridLayoutGroup Component to implement this function :
1、 stay GameObject Add Text The components are made into a prefabricated Item;
2、 Replace the text string that needs to be displayed in the vertical line with Char Array ;
3、 Circular array , Instantiation Item, take Char The values in the array are set to Item Of Text Inside the component , One Item Set a value ;( If you have line breaks in your text , You need to calculate the space added to Array or List Inside )
4、 Set up GridLayoutGroup attribute , utilize GridLayoutGroup Realize the function of displaying text in vertical line .

This is me GridLayoutGroup Set properties . The renderings are as follows :

That's what I passed GridLayoutGroup Component to realize the vertical line display of string , If you don't have much text 、 unchanging , This method can be used , If you have a lot of text , The converted character array is relatively large , It is not recommended to use . The best way is to rewrite Text Well , But I saw Text Source code , I don't know where to start .
If you have a better way , Looking forward to your sharing !
边栏推荐
- 【C语言】如何很好的实现复数类型
- Pyqt5 visual development
- Multi dimensional monitoring: the data base of intelligent monitoring
- Remoteviews layout and type restriction source code analysis
- 30套JSP网站源代码合集「建议收藏」
- 【C语言】NextDay问题
- [C language] three sorting methods for random number files
- ByteV搭建动态数字孪生网络安全平台----助力网络安全发展
- Redis principle - List
- 4. maximum continuity factor
猜你喜欢

【Unity编辑器扩展基础】、EditorGUILayout (一)

多维度监控:智能监控的数据基础

Web3 security serials (3) | in depth disclosure of NFT fishing process and prevention techniques

【C语言】二叉树的实现及三种遍历

Function and principle of remoteviews
![[C language] three sorting methods for random number files](/img/a5/363133a0c85aa43c6cd8287e479f71.jpg)
[C language] three sorting methods for random number files

Remoteviews layout and type restriction source code analysis

What is the difference between internal oscillator, passive crystal oscillator and active crystal oscillator?

2018 joint examination of nine provinces & Merging of line segment trees

【Unity编辑器扩展基础】、EditorGUILayout(二)
随机推荐
Asynctask experience summary
Unity加载设置:Application.backgroundLoadingPriority
If you want to change to software testing, how can you package your resume as a test engineer with 1 year of work experience
Prefix and (2D)
fatal: unsafe repository (‘/home/anji/gopath/src/gateway‘ is owned by someone else)
30套JSP网站源代码合集「建议收藏」
JNI函数的2种书写方式
6. calculation index
Still using simpledateformat for time formatting? Be careful that the project collapses!
Share the easy-to-use fastadmin open source system - practical part
【经验分享】Django开发中常用到的数据库操作总结
IDEA全局搜索快捷设置
How to deploy the software testing environment?
JNI confusion of Android Application Security
【C语言】如何很好的实现复数类型
内部振荡器、无源晶振、有源晶振有什么区别?
KDD 2022 | graph neural network generalization framework under the paradigm of "pre training, prompting and fine tuning"
Graphics view framework for QT learning (to realize startup animation)
【C语言】随机数文件对其进行三种排序方法
【C语言】判断三角形