playMaker

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

velketor

  • Junior Playmaker
  • **
  • Posts: 69
  • Multimedia Marathon Man
    • Shawn Kilian Portfolio
Gesture Scrolling Limit on Android [SOLVED]
« on: August 15, 2017, 10: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, 09:20:25 AM by Shawn Kilian »

velketor

  • Junior Playmaker
  • **
  • Posts: 69
  • Multimedia Marathon Man
    • Shawn Kilian Portfolio
Re: Gesture Scrolling Limit on Android
« Reply #1 on: August 16, 2017, 09: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, 02:49:37 PM by Shawn Kilian »