- Home /
Question by
mrvin · Sep 28, 2012 at 07:38 PM ·
getmousebuttondown
Input.GetMouseButonDown(0) problem
i dont know what happen to my unity. before, the game object must be click to trigger the effect but for some reason, it trigger whenever I click anywhere? what happen? pls help... :(
same thing happens even if I created a new project...
Comment
Answer by hvilela · Sep 28, 2012 at 08:58 PM
No problem here, that's the expected behavior. Input.GetMouseButomDown will return true if the mouse is pressed, no matter where. Check the documentation.
If you want that it triggers only when it's over your object, you have to check it with a ray cast.
Your answer
Follow this Question
Related Questions
Create objects in a selected area 2 Answers
MouseClick not counted 0 Answers
Irregular jumping 1 Answer
Using Multiple Prefabs with Multiouch 0 Answers
Getting no response from Raycast 2 Answers