Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: Malzbier on July 20, 2012, 03:20:43 AM
-
Hallo, im currently trying to to make a drag and drop action be initialized by a script.
My scenario:
Press on Button -> Instantiate prefab with drag and drop script -> Drag and drop is enabled for the new script and the object is moving with the dragging input.
How to enable the the last step?
Calling OnPress(true) (now public) in the dragdrop script does not do the trick.
Thanks for reply
-
Try manually setting the UICamera.selectedObject to be the object you want to drag around.
-
Setting the UICamera.selectedObject to be the object i want to drag around does not work at all.
The problem seems to be that a button is directly under the the generated drag able object.
Dragging works fine if i deactivate the button after creation and press again on the drag able object.
The key is that i need the drag to run directly with the first press / touch.
-
Selecting the object isn't enough. You need to give it touch focus. UICamera.currentTouch.pressed = yourNewGameObject.
-
Thanks to both of you: both tips together done the trick.