1
NGUI 3 Support / Re: UI Drag Drop Item
« on: September 29, 2015, 06:29:54 PM »
All right, thank you for the tips!
It did worked for me to Instantiate a Prefab right at the moment when UI-element leaves the UI panel, but I cannot get it work to continue dragging instantiated object? The new object doesn't receive a focus, I get that, but need some advice how to solve this problem.
edited
btw, I'm using: NGUITools.Destroy(gameObject);
for the UI-element instead of alpha=0. I have a UI-container with 2 sprites in it, not sure how to change alpha for this one..
I have 'UIDragDropItem' script attached to UI-element and I call from here Instantiate function, which is in another script (Global manager):
an instantiated object has its own 'onDrag' script.
My Main Camera is for the game objects, and UI Camera for NGUI, so.. if I understand it right, these two receive their own events? shall I do Raycast for the 'Main Camera' right after instantiation?
Would you be so kind and share some code example perhaps of how to switch from dragging of UI-element to that new instantiated game object? so I have one continuous drag movement. Thanks.
It did worked for me to Instantiate a Prefab right at the moment when UI-element leaves the UI panel, but I cannot get it work to continue dragging instantiated object? The new object doesn't receive a focus, I get that, but need some advice how to solve this problem.
edited
btw, I'm using: NGUITools.Destroy(gameObject);
for the UI-element instead of alpha=0. I have a UI-container with 2 sprites in it, not sure how to change alpha for this one..
I have 'UIDragDropItem' script attached to UI-element and I call from here Instantiate function, which is in another script (Global manager):
- protected void OnDrag (Vector2 delta) {
- ...
- if(UICamera.hoveredObject.name == ("hoveredBase"))
- Manager.Instantiate...
- ...
- }
My Main Camera is for the game objects, and UI Camera for NGUI, so.. if I understand it right, these two receive their own events? shall I do Raycast for the 'Main Camera' right after instantiation?
Would you be so kind and share some code example perhaps of how to switch from dragging of UI-element to that new instantiated game object? so I have one continuous drag movement. Thanks.

