Im trying to copy some game does about how they make a HUD and then when u press some icon itll be a game object where you can drag N drop it. For example the game C0C where when u click the house itll eventrually be a game object and you can place it anywhere else…
I have this code
if(!IsBeingDrag){
IsBeingDrag = true;
GameObject instance = Instantiate(bombInstance);
Vector3 mousePosition = new Vector3(Input.mousePosition.x,Input.mousePosition.y,19);
instance.transform.position = Camera.main.ScreenToWorldPoint(mousePosition);
}
problem here is I have to click twice. One for the HUD icon and the other for the instantiated object. Can someone help me how to attain the Drag N Drop HUD icon where many games do?