Author Topic: Drag and Drop Container Without Grid  (Read 2444 times)

docgonzzo

  • Newbie
  • *
  • Thank You
  • -Given: 3
  • -Receive: 0
  • Posts: 10
    • View Profile
Drag and Drop Container Without Grid
« on: October 08, 2015, 07:04:14 PM »
I'm having trouble figuring out how to setup a drag and drop "Slot" style of functionality for multiple DragAndDropItems.

Currently, I have an object with UIDragDropContainer that reparents UIDragDropItems to just itself.

I dont want to use a Grid or Table. I want to keep all the UIDragDropItems together, under a parent game object, occupying the same space/location. At any given time, all but one of the children UIDragDropItems game objects will be disabled.

However, Without the UIGrid or UITable, the UIDragDropItems dont tween and "snap" into the container's center.

Do you have any hints on how to seup something like this without UIGrid?


Thanks!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Drag and Drop Container Without Grid
« Reply #1 on: October 10, 2015, 11:33:11 PM »
I used a grid only for positioning in Windward. In Windward I have inventory "cells", each cell has a class derived from UIDragDropContainer on it that may or may not have a child with a script derived from UIDragDropItem on it. In the UIDragDropItem-derived class' OnDragDropRelease I check to see if the container already has an item, and if so I swap it with the one I am about to drop. If not, it's dropped as-is. This limits each container to holding only 1 item.