Hi all.
In my game, i want to drag and drop an image, and then record which image has been dragged (there are multiple images). So basically, I want to record the id of the image on ‘dragend’.
I’ve tried doing gameObject.id and gameObject.key but it doesn’t work.
I was thinking I know the coordinate of each image at ‘dragstart’ so if I could record the cordinate of the image at dragstart and dragend, i would know which image it is.
If you are listening to the drag events on the game object, then the game object itself is the context of the event (this). If you are listening to the Input system, then it’s returned as gameObject in the event.
Not sure what you are assigning as .id or .key, but you might want to use the existing .name, or store things in .data with DataManager.