Author Topic: Drag and Drop tutorial  (Read 6460 times)


  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 248
    • View Profile
Drag and Drop tutorial
« on: June 26, 2012, 03:45:09 AM »
I am guessing this is already a no, but I don't suppose there is a very simple tutorial on how to use UIDragObject?

I have dissected the Orc equipping and items on a cube examples of drag and drop but they seem a bit advanced for me to look at. I can understand that on the Orc one that once you click on an object it moves from the 3D gui to the 2d gui one. But when I try to take things out, such as deleting the Orc, all of a sudden nothing seems to appear anymore. And the prepared inventory stuff just adds to the confusion.

I'm more interested in the simple functionality, such as just working out how to do something really basic like how to how to drag an item from one box to the other would be really handy.


  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 64
    • View Profile
Re: Drag and Drop tutorial
« Reply #1 on: June 26, 2012, 07:12:45 AM »
I've just started using NGUI, and first thing I did was to try out UIDragObject. Real simple!

1)Attach the script to a sprite that has a collider
2)Drag and drop your target transform in the target field (could be your sprite's transform, or a parent's if you want to move all children together)
3) Play, drag, and drop!

Hope it helps,