playMaker

Author Topic: Gesture Scrolling Limit on Android [SOLVED]  (Read 149 times)

Shawn Kilian

  • Playmaker Newbie
  • *
  • Posts: 43
  • Multimedia Designer
    • View Profile
Gesture Scrolling Limit on Android [SOLVED]
« on: August 15, 2017, 07:09:24 AM »
Hello,

How can I limit the scrolling of a gesture swipe event?  When I swipe up, my screen scrolls down but it doesn't know when it's reached the end of the screen so it just keeps on going.  Whenever I put a float clamp on it, that works but not for every device since each device has a different screen width/height.  I tried using Get Screen Width and Get Screen Height but the values returned are always zero.

Am I doing this the wrong way?  I just want to swipe down to the bottom of my phones screen, then swipe up to go back to the top.  I figured it would be simple but I think I'm complicating it.  Please help!!!
« Last Edit: August 16, 2017, 06:20:25 AM by Shawn Kilian »

Shawn Kilian

  • Playmaker Newbie
  • *
  • Posts: 43
  • Multimedia Designer
    • View Profile
Re: Gesture Scrolling Limit on Android
« Reply #1 on: August 16, 2017, 06:20:08 AM »
I figured out how to do it.  You don't need PlayMaker to achieve this functionality.  In fact you don't even need to use the Gesture Action at all.

Simply add an Image (Script) component in combination with a Mask (Script) component to the CONTENT (not the canvas), effectively limiting the scrolling of the view-port to whatever the mask can see within that canvas. It's perfect!

Note:  Make sure your CONTENT is a child of the CANVAS.  The CANVAS needs a Scroll Rect (Script) component where you reference the "Content" and "Viewport".

You can watch a video tutorial here https://unity3d.com/learn/tutorials/modules/beginner/ui/ui-scroll-rect
« Last Edit: August 22, 2017, 11:49:37 AM by Shawn Kilian »