(Help) How can i make an Ui drag and drop?

Hello everyone, I am making a 2d puzzle game and everything seems to work really well.
Than i faced a problem.

Problem:
Pretend there is a 2D sprite which is a triangle(doesn’t matter if its anything) and a drag and drop script attached to it. Now what i want to do is to create a UI (Inventory type of thingy) with the images of the 2D triangle. When i drag the image It becomes that 2d object and stays on the finger so that i can drag it anywhere.

Explanation:
At first i did it like (when you click the ui image it instantiate the object in the position of the finger but it doesn’t stay n the finger) which is a not what i want.
what i want is when you drag the image, the image itself disappear and a 2d object is instantiated and stays on your finger(not that you have to drag it again).

Hope you understand ;-(

I did not understand, but if you google @Kiwasi YouTube, you will find a drag and drop example, well explained. Maybe that helps you

1 Like

@Faisal_Azizi

Hi there, have you checked official Unity UI demos? There is a drag and drop example;

I’m not sure if I got your question correctly, but It’s possible to just hide the image/transform you “pick” and then show some other image while dragging, then when you end drag, i.e. you “drop” the item, then hide the image you show while dragging, and drop the original picked image to slot.

Thanks for the shout out. This I believe is the video of interest.

https://www.youtube.com/watch?v=c47QYgsJrWc

In some cases you’ll have to play around with converting the mouse position to a world one. Camera has some useful methods for this.

Thank you all for your replies!
And guess what, i got it done thanks to the BoredMormon and Those official unity assets combined.
and its working the way i wanted.

Here is the 4 minute guide to make your every ui element dragable