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