- Home /
How to detect a mouse click on a 2d gameobject?
Hey all, like the questions says I'm trying to figure out how to detect a mouse click on a 2d object and have that object be "selected". I've seen the other posts on this topic and how its done with ray casting but from i have tried it doesn't seem to work for me. Does that work in this case with 2d objects or is it a completely different process? Heres what I got so far:
Let me know if there is anything else that you all might need to better answer this question. Thanks in advance.
Answer by greencheese122 · May 25, 2018 at 06:41 AM
in OnMouseDown funtion O needs to be capitalized Also don't call it in Update,it will be called automatically when you click the object.
Your answer
Follow this Question
Related Questions
LookAt() not working with mouse as target in 2D 1 Answer
how to drag an object using 2d raycasts 0 Answers
Sidescroller Bullets Follow Mouse After Being Shot 2 Answers
Preventing mouseclicks outside the game window 1 Answer
I am making a 2d game and I want to make it where to can pick up bricks with your mouse 3 Answers