当前位置:网站首页>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 !
边栏推荐
- 【北京航空航天大学】考研初试复试资料分享
- Convert black mask picture to color annotation file
- [Beijing University of Aeronautics and Astronautics] information sharing for the first and second examinations of postgraduate entrance examination
- AcWing 605. Simple product (implemented in C language)
- Levels – 虚幻引擎场景制作「建议收藏」
- Using MySQL database in the express framework of node
- Come on, yuanuniverse. Sure enough, the heat won't pass for a while
- Privilege management of vivo mobile phone
- [C language] use of file read / write function
- EMC RS485 interface EMC circuit design scheme
猜你喜欢

Redis principle - List

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

SEO优化的许多好处是与流量有直接关系

In less than an hour, apple destroyed 15 startups
Three ways to implement LRU cache (recommended Collection)

If you want to change to software testing, how can you package your resume as a test engineer with 1 year of work experience

Leetcode 705. 设计哈希集合

Self use demo of basic component integration of fluent

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

How to deploy the software testing environment?
随机推荐
Multi dimensional monitoring: the data base of intelligent monitoring
AGCO AI frontier promotion (2.16)
Privilege management of vivo mobile phone
30套JSP网站源代码合集「建议收藏」
Deep learning has a new pit! The University of Sydney proposed a new cross modal task, using text to guide image matting
Redis 原理 - List
What is data compliance? How to achieve data compliance?
SEO优化的许多好处是与流量有直接关系
Leetcode 48. 旋转图像(可以,已解决)
NFT数字藏品系统开发(3D建模经济模型开发案例)
UGUI使用小技巧(六)Unity实现字符串竖行显示
Connectionreseterror: [winerror 10054] the remote host forced an existing connection to be closed
模板_大整数乘法
Redis hash hash type string (5)
多维度监控:智能监控的数据基础
IDEA全局搜索快捷设置
[C language] use of nested secondary pointer of structure
Come on, yuanuniverse. Sure enough, the heat won't pass for a while
URL append parameter method, considering #$ Situation of
Daily practice of C language - day 4: find the sum of all even numbers within 100