Author Topic: NGUI sprite snap to button  (Read 3083 times)

kevinjohnson25

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1
    • View Profile
NGUI sprite snap to button
« on: July 27, 2013, 02:16:16 AM »
Hello,

Sorry if this has been asked before but I couldn't figure out search terms that gave me what I wanted. Anyway, for my game (mobile, touchscreen) I have several buttons onscreen and several NGUI widgets offscreen. What I want to happen is that when the user presses a button, the appropriate offscreen widget snaps to the button position and then can be dragged as if the player started the touch on the offscreen widget itself (getting directly into OnDrag). Right now I can make the widget snap to the position but the user has to tap/press again to get the drag function. I'm using UIDragObject for the offscreen widgets. Would I need to write my own dragging script to create the behavior I want?

Thanks!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NGUI sprite snap to button
« Reply #1 on: July 27, 2013, 01:12:55 PM »
UICamera.currentTouch has a bunch of properties, including the currently dragged object. You need to set it to the object you're trying to drag.