当前位置:网站首页>Tips for using ugui (V) using scroll rect component
Tips for using ugui (V) using scroll rect component
2022-06-28 12:21:00 【Unique_ eight hundred and forty-nine million nine hundred and n】
In function development , Because you may need to display a lot of data , But an interface cannot be displayed , You will often encounter a list that needs sliding , Such as Backpack , Rankings, etc , These places are basically used Unity3D Of Scroll Rect Component to realize sliding function . besides ,Scroll Rect There are also some tips , Can be used to slide text , picture , Achieve some other functions .
One 、 Basic usage
Frequently used components :Scroll Rect、Mask、GridLayoutGroup
First Unity Of Hierarchy Panel Canvas Next create a Scroll View, Right click UI->Scroll View( Because I don't need a slider , So I deleted it Scrollbar Horizontal and Scrollbar Vertical), And then in Scroll View Under the Content Add... Under sub object GridLayoutGroup Components , Then add your sub objects to Content Next , such , The simplest sliding frame is done . Of course , You can also create empty objects , Add... Yourself Scroll Rect、Mask、GridLayoutGroup Component to implement the function of the sliding box .

The main idea is :Scroll Rect The assembly is responsible for sliding ,Scroll Rect Under components Content Is the sliding area ,Horizontal and Vertical The two parameters determine whether the sliding is left or right , Slide up and down ,MovementType Is a sliding type .Mask The component is responsible for controlling the visible area .GridLayoutGroup Components are responsible for the distribution of sub objects .
Two 、 Tips : Controls the sliding of text
In development , Maybe yours UI The interface needs to show a lot of things , But there is no place to show you , You'll cover something else , Or something else will cover you . As described , Chinese translation into English , The name is added with district service, etc , You can change the text to slidable .
Frequently used components :Scroll Rect、Mask、ContentSizeFitter
The principle of controlling text sliding is similar , It's just that there's no need to Content Add distribution components on GridLayoutGroup, But in Content Create Text, stay Text Add ContentSizeFitter Components , Set up HorizonttalFit Property or VertiaclFit attribute . So you can drag and drop the text to see the blocked content .
3、 ... and 、 Tips : Control the sliding of the picture
In development , When you encounter a large background picture , It's over Canvas Range , If the size is fixed, some things will not display completely , If you show everything in one Canvas in , In the embarrassing problem of compressing the graph to a very small size , Maybe it can be achieved by sliding the background image . Like a little map , Some background pictures, etc .
Components used :Scroll Rect、Mask
stay Content Create a picture under , This picture is the background you want to drag . There is no need to add other components ,ScrollRect The other properties of are set according to your specific situation .

Be careful :Mask stay ViewPort Next ,ViewPort The size that should be set is yours Canvas Size ( Specific personal settings ),Content Is a range that can be dragged ,Image The size is the size of your picture , I set the two objects to the same size .
Hey , So you can see all the background pictures .

The above is what I often use in projects Scroll Rect Component tips . If you have more Scroll Rect Component usage tips , Looking forward to your sharing !
边栏推荐
- Levels – virtual engine scene production "suggestions collection"
- Unity导入资源后还手动修改资源的属性?这段代码可以给你节约很多时间:AssetPostprocessor
- Mr. Zhang responded to the first live broadcast with goods
- 【C语言】结构体嵌套二级指针的使用
- 开源项目维权成功案例: spug 开源运维平台成功维权
- How to deploy the software testing environment?
- Remoteviews layout and type restriction source code analysis
- Android应用安全之JNI混淆
- 运维思考 | 你知道CMDB与监控是什么关系吗?
- 【C语言】关于scanf()与scanf_s()的一些问题
猜你喜欢

Deep learning has a new pit! The University of Sydney proposed a new cross modal task, using text to guide image matting

UGUI使用小技巧(六)Unity实现字符串竖行显示

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

In less than an hour, apple destroyed 15 startups

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

纯纯大怨种!那些年被劝退的考研专业
![Connectionreseterror: [winerror 10054] the remote host forced an existing connection to be closed](/img/9a/97813f5ac4d7c15711891cff25b9dd.jpg)
Connectionreseterror: [winerror 10054] the remote host forced an existing connection to be closed

深度学习又有新坑了!悉尼大学提出全新跨模态任务,用文本指导图像进行抠图...

ArrayList源码解析

Remoteviews layout and type restriction source code analysis
随机推荐
Url追加参数方法,考虑#、?、$的情况
Levels – virtual engine scene production "suggestions collection"
华泰证券开户安全吗? 开户有风险吗
cdc同步 如果数据库表的主键发生了变化,会同步成两个数据 还是会同步更新主键呢?
Android应用安全之JNI混淆
AcWing 604. Area of circle (implemented in C language)
Function and principle of remoteviews
In less than an hour, apple destroyed 15 startups
AcWing 607. Average 2 (implemented in C language)
Levels – 虚幻引擎场景制作「建议收藏」
【经验分享】Django开发中常用到的数据库操作总结
Multi dimensional monitoring: the data base of intelligent monitoring
PyQt5可视化开发
SHA256加密工具类
URL append parameter method, considering #$ Situation of
UGUI使用小技巧(六)Unity实现字符串竖行显示
MapReduce项目案例3——温度统计
PrecomputedTextCompat用法及原理
Pyqt5 visual development
Data analysis learning notes