当前位置:网站首页>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 !
边栏推荐
- Map排序工具类
- 张同学回应首场直播带货
- Still using simpledateformat for time formatting? Be careful that the project collapses!
- Usage and principle of precomputedtextcompat
- Int~long long indicates the maximum and minimum number
- UGUI使用小技巧(五) Scroll Rect组件的使用
- Database Series: is there any way to seamlessly upgrade the business tables of the database
- [Beijing University of Aeronautics and Astronautics] information sharing for the first and second examinations of postgraduate entrance examination
- 2022年理财产品的常见模式有哪些?
- 多维度监控:智能监控的数据基础
猜你喜欢
Graphics view framework for QT learning (to realize startup animation)
[C language] three sorting methods for random number files
Leetcode 705. 设计哈希集合
【C语言】二叉树的实现及三种遍历
Connectionreseterror: [winerror 10054] the remote host forced an existing connection to be closed
Prepare for Jin San Yin Si I. testers without experience in automated testing projects should look at it quickly
【Unity编辑器扩展基础】、GUI
【Unity编辑器扩展实践】、利用txt模板动态生成UI代码
[C language] about scanf() and scanf_ Some problems of s()
What is data compliance? How to achieve data compliance?
随机推荐
Vivo手机的权限管理
Truly understand triode beginner level chapter (Classic) "suggestions collection"
Daily practice of C language - day 3: calculate the number of occurrences of sub strings of strings
IO stream of file and Base64
内部振荡器、无源晶振、有源晶振有什么区别?
Redis hash hash type string (5)
Research on personalized product search
Software test interview classic + 1000 high-frequency real questions, and the hit rate of big companies is 80%
【C语言】如何很好的实现复数类型
URL append parameter method, considering #$ Situation of
6. calculation index
Two writing methods of JNI function
Django -- MySQL database reflects the mapping data model to models
Map sorting tool class
In less than an hour, apple destroyed 15 startups
案例驱动 :从入门到掌握Shell编程详细指南
Zero basic C language (I)
Source code analysis of ArrayList
【C语言】文件读写函数使用
AcWing 608. Poor (implemented in C language)