当前位置:网站首页>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语言】如何产生正态分布或高斯分布随机数
- Zero basic C language (I)
- [C language] use of nested secondary pointer of structure
- Given two points and a point with a middle scale, find the coordinates of the point
- Two writing methods of JNI function
- 【C语言】二叉树的实现及三种遍历
- 多维度监控:智能监控的数据基础
- Software test interview classic + 1000 high-frequency real questions, and the hit rate of big companies is 80%
- MapReduce project case 1
- EMC RS485接口EMC电路设计方案
猜你喜欢
![[C language] three sorting methods for random number files](/img/a5/363133a0c85aa43c6cd8287e479f71.jpg)
[C language] three sorting methods for random number files
Using MySQL database in the express framework of node

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

Data analysis learning notes

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

【Unity编辑器扩展实践】、利用txt模板动态生成UI代码

【C语言】判断三角形

【C语言】关于scanf()与scanf_s()的一些问题

洛谷_P1303 A*B Problem_高精度计算

Necessary for beginners PR 2021 quick start tutorial, PR green screen matting operation method
随机推荐
Unity导入资源后还手动修改资源的属性?这段代码可以给你节约很多时间:AssetPostprocessor
SEO优化的许多好处是与流量有直接关系
Leetcode 705. 设计哈希集合
【Unity编辑器扩展基础】、GUILayout
Daily practice of C language - day 3: calculate the number of occurrences of sub strings of strings
【Unity编辑器扩展基础】、EditorGUILayout (一)
What is the difference between internal oscillator, passive crystal oscillator and active crystal oscillator?
【C语言】关于scanf()与scanf_s()的一些问题
EMC RS485接口EMC电路设计方案
cdc同步 如果数据库表的主键发生了变化,会同步成两个数据 还是会同步更新主键呢?
Truly understand triode beginner level chapter (Classic) "suggestions collection"
SHA256加密工具类
Two writing methods of JNI function
Remoteviews layout and type restriction source code analysis
Difference (one dimension)
Bisection (integer bisection and floating point bisection)
Build your own website (18)
C语言 sprintf函数使用详解
AcWing 607. Average 2 (implemented in C language)
Open3d manual clipping point cloud