Tuesday, July 7, 2015

Unity tutorial: swipe controlled ScrollRect with items snapping






 When using mobile apps you often see screen with list of items you can list through with finger swipes. Currently I also need such screen for one of my games. First, I searched through internet and found this page at Bitbucket. There is "HorizontalScrollSnap" component, but unfortunately, I did not managed to make it work, so I decided to create my own.

 My target was also to create component, that will work not only horizontally, but also vertically.

 Here is screenshots of component in action.


  Final component is one C# script (about 300 lines of code) and you can use it in your projects if you download it here.

 Here is short video showing how to set up the component and what are its features: