0

i search how to move an object with the mouse , only after clicked on the object ( the same ) . I tried somes things but nothing happened . If u have an answer , please help me .

void Update()
{
    if (Input.GetMouseButtonDown(0) && Mouse.Position.X == GameObject.X)
    {
        //Code here
    }
}

The system dont understand Position.X after Mouse and X after GameObject

PS : I work for a game board , so i've a lot of objects , and i don't know how to use the fonction collid , i tried but without the mouse code ( the precedent code i try to find ) , i can't see if it works or not .

Sorry for my english .``

giokoguashvili
  • 2,013
  • 3
  • 18
  • 37
molikayess
  • 11
  • 2
  • 1
    Try `Mouse.transform.position.x` and `GameObject.transform.position.x` – Detonar Nov 24 '17 at 10:20
  • 1
    Please, take a look at [this question](https://stackoverflow.com/questions/41391708/how-to-detect-click-touch-events-on-ui-and-gameobjects) to detect click on objects (and detect dragging object) – Hellium Nov 24 '17 at 10:21

0 Answers0