Author Topic: Detecting when drag moves off a collider  (Read 3409 times)

Moradom

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 15
    • View Profile
Detecting when drag moves off a collider
« on: January 22, 2014, 08:28:25 PM »
Hello all,

I am looking for a way to detect when when a touch drags off a collider. For example a touch is detected on a collider with OnPress() then I would like to know when that touch drags off that collider.

After reviewing the UICamera's notification events I didn't see a specific notification for that.

Thanks

Moradom

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 15
    • View Profile
Re: Detecting when drag moves off a collider
« Reply #1 on: January 22, 2014, 09:07:27 PM »
Wanted to share a quick update

I am sure there might be a better way, but I was able to get this behavior by checking the tag in the UICamera.hoveredObject in the OnDrag event handler. Once I detected the tag changed from the touched gameObject I knew the touch was dragged off the collider.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Detecting when drag moves off a collider
« Reply #2 on: January 23, 2014, 05:57:21 AM »
OnDragOut tells you when you've left a collider. OnDragOver tells you when you've moved over a collider.