Author Topic: Stuck at Drag & Drop using NGUI  (Read 6356 times)

thomastai

  • Guest
Stuck at Drag & Drop using NGUI
« on: May 08, 2013, 11:12:05 PM »
Hi, I am a Unity and NGUI newbie working on my first game.
Basically I want to create a 2D chess-like game where a pawn can be dragged and dropped across the chess board.

I've used UIDragObject which successfully made the pawn draggable and fire the OnDrag() event. However there's no way I can get the chess board to fire the OnDrop() event.

I switched to use DragDropItem for the pawn, DragDropRoot for a panel and DragDropSurface for the chess board. Now the chess board can fire OnDrop() event, but the pawn can only be dragged and dropped once.

Am I using the right components? Anyone please point me to the right direction.
BTW I have studied the Character Inventory and Drag Drop Example that comes with the NGUI package.

Thanks a lot!
Thomas

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Stuck at Drag & Drop using NGUI
« Reply #1 on: May 09, 2013, 07:20:20 AM »
When dragging something, you must disable its collider, or it will intercept the OnDrop event. Examine the Drag & Drop example for more info.