Author Topic: How do I drag a prefab that is not in UIroot into UIroot?  (Read 1343 times)

seamusc

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
How do I drag a prefab that is not in UIroot into UIroot?
« on: August 28, 2014, 11:55:11 AM »
 I am trying to drag a prefab into UIroot and vice versa, could anyone please point me in the right direction.. I've also tried putting the entire game asset under UIroot for drag and drop, no luck there.
 
 Is there any tutorials on how to use the NGUI UI to drag around sprites that are not in UIroot, do you use anchors to do this?

 I am going to review the Inventory Drag and drop tutorial again to see how the pieces of armor are created on the box after the drag and drop. 

 Thanks for any direction.
 
 Seamus
« Last Edit: August 28, 2014, 06:15:24 PM by seamusc »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: How do I drag a prefab that is not in UIroot into UIroot?
« Reply #1 on: August 28, 2014, 09:28:32 PM »
In short, you can't drag something outside of UIRoot onto it. Note that the 3D armor pieces are created after the drag & drop operation finishes. I don't do it the other way around. UI is always drawn after the 3D world. Your best bet is to create a UI element when you press on a 3D object, and do drag & drop like that. Have a look at UIDragDropItem.StartDragging / StopDragging.