当前位置:网站首页>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 !
边栏推荐
- Chendanqi, Fang Fei, guquanquan and Li Bo won the prize, and the list of Sloan research award in 2022 was released
- RemoteViews的作用及原理
- Two writing methods of JNI function
- MapReduce project case 3 - temperature statistics
- 【Unity编辑器扩展基础】、EditorGUILayout(二)
- PyQt5可视化开发
- 华泰证券开户安全吗? 开户有风险吗
- 【Unity编辑器扩展基础】、EditorGUILayout (一)
- RemoteViews布局和类型限制源码分析
- KDD 2022 | graph neural network generalization framework under the paradigm of "pre training, prompting and fine tuning"
猜你喜欢

建立自己的网站(18)

In less than an hour, apple destroyed 15 startups

Why do many people want to change careers as programmers, while some programmers want to change careers as others?

Convert black mask picture to color annotation file
![[vi/vim] basic usage and command summary](/img/bc/0be3ae3f122c3c21b480e0678095a1.png)
[vi/vim] basic usage and command summary

【C语言】结构体嵌套二级指针的使用

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

Self use demo of basic component integration of fluent

RemoteViews的作用及原理

【C语言】二叉树的实现及三种遍历
随机推荐
Pyqt5 visual development
搭建学习环境
AcWing 606. Average 1 (implemented in C language)
Prefix and (2D)
2018 joint examination of nine provinces & Merging of line segment trees
Chendanqi, Fang Fei, guquanquan and Li Bo won the prize, and the list of Sloan research award in 2022 was released
EMC RS485接口EMC电路设计方案
Prepare for Jin San Yin Si I. testers without experience in automated testing projects should look at it quickly
【C语言】关于scanf()与scanf_s()的一些问题
AcWing 610. Salary and bonus (implemented in C language)
6.A-B
[vi/vim] basic usage and command summary
多维度监控:智能监控的数据基础
Software test interview classic + 1000 high-frequency real questions, and the hit rate of big companies is 80%
【附源码+代码注释】误差状态卡尔曼滤波(error-state Kalman Filter),扩展卡尔曼滤波,实现GPS+IMU融合,EKF ESKF GPS+IMU
Necessary for beginners PR 2021 quick start tutorial, PR green screen matting operation method
Custom title bar view
.NET混合开发解决方案24 WebView2对比CefSharp的超强优势
[C language] about scanf() and scanf_ Some problems of s()
【经验分享】Django开发中常用到的数据库操作总结