Greetings,
We have a horizontal scrollview/inventory at the bottom of the screen where you can drag objects/train cars into the scene to build your train (2d game). Works fine. I want to go the other way around now. I want to click on a train car in the scene and be able to drag/drop it back to the UI.
One approach I could try is manually picking it up and handle moving it with the mouse and detect if it's released over the UI to add it back to the grid/inventory. Problem with that is depth. It will always appear behind the UI because of depth/sorting issues cause the UI renders on top.
The other approach which I'm trying now is to 'simulate' a UI drag. So when I click on a car in the scene, I 'instantly' add it to the grid, and then send an NGUI 'drag' event of some sort which will snap it to the mouse position and perform its drag.
But I'm not sure how to exactly achieve the latter. I tried calling 'StartDragging' from UIDragDropItem but it didn't do anything. Digging more into the code (UICamera) it seems I have to create a touch or mouse event? I'm not sure.
Maybe there is a better way of doing this?
Any ideas or pointers are appreciated?
Thanks.