Author Topic: Detecting Camera Scroll for Scroll View Camera Example 8  (Read 4622 times)

Sarus

  • Guest
Detecting Camera Scroll for Scroll View Camera Example 8
« on: April 12, 2012, 07:07:52 PM »
Hello,

I need to be able to detect when the user is attempting to scroll the camera in Scroll View (Camera) Example 8.  What's the best way to do this?  Since the camera itself doesn't have a collider it doesn't seem possible to add a script to it and listen for OnDrag() events.  Is there another way to do this?

Basically my scroll view is overlaid on top of my game board.  I need to know when the user is scrolling the scroll view so I can prevent the dragging motion from moving the game's main camera (this is for a mobile device).

Thank you!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Detecting Camera Scroll for Scroll View Camera Example 8
« Reply #1 on: April 13, 2012, 03:00:32 PM »
You can just add some custom code to UIDraggableCamera.Drag.

Sarus

  • Guest
Re: Detecting Camera Scroll for Scroll View Camera Example 8
« Reply #2 on: April 14, 2012, 08:40:22 PM »
Thank you.  I went ahead and put the code directly into UIDraggableCamera.Drag and UIDraggableCamera.Press

It would be great if OnDrag and OnPress callbacks were available for this script so the core NGUI code doesn't have to be changed but making the change directly was straightforward.