Unity3d Ugui scrolling View scrollview use tutorial Easy backpack

Source: Internet
Author: User

In Unity3d, Ugui provides three components of the Scroll Rect, Grid Layout Group, mask, which we use to implement a scrolling view, with a simple backpack as an example.

Article turn from http://blog.csdn.net/huutu/star Ring game http://www.thisisgame.com.cn

First we place the bottom box of the backpack, such as.


We are in the red piece, as the sliding area of the inventory. article turn from http://blog.csdn.net/huutu/star Ring game http://www.thisisgame.com.cn

Next, create a panel that is renamed Scrollrectpanel, pulling the size to the red box size. First Reset, add the scroll Rect component. Tick the Vertical box, meaning that only the y-axis can slide.


Then add a Panel below Scrollrectpanel as child, renamed Gridlayoutpanel, reset, stretch width to red box width, height slightly larger. Add the Grid Layout Group component. The modified color is red for easy differentiation. article turn from http://blog.csdn.net/huutu/star Ring game http://www.thisisgame.com.cn



Then select Scrollrectpanel and drag the Gridlayoutpanel into the content of the Scroll Rect. article turn from http://blog.csdn.net/huutu/star Ring game http://www.thisisgame.com.cn

Article turn from http://blog.csdn.net/huutu/star Ring game http://www.thisisgame.com.cn

Run the test and you can now swipe up and down. article turn from http://blog.csdn.net/huutu/star Ring game http://www.thisisgame.com.cn

Article turn from http://blog.csdn.net/huutu/star Ring game http://www.thisisgame.com.cn

Then add a button as child under Gridlayoutpanel, and then CTRL + D to copy out more than one. article turn from http://blog.csdn.net/huutu/star Ring game http://www.thisisgame.com.cn

Article turn from http://blog.csdn.net/huutu/star Ring game http://www.thisisgame.com.cn

Finally, add the Mask component on the Scrollrectpanel so that it does not display beyond the Scrollrectpanel range. article turn from http://blog.csdn.net/huutu/star Ring game http://www.thisisgame.com.cn

Article turn from http://blog.csdn.net/huutu/star Ring game http://www.thisisgame.com.cn

Finally take a look at the effect article turn from http://blog.csdn.net/huutu/star Ring game http://www.thisisgame.com.cn


Unity3d Ugui scrolling View scrollview use tutorial Easy backpack

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.