Help Detecting Mouse Point in a 2D Game (Unity 4.3)

Hello,

I would like to get the position the mouse in my 2D game. I already know about Input.mousePosition. I saw many topics about how to find it with 3D, but they all used a 3d raycast.

Thanks in advance!

MileSplit

You have two choices. First the OnMouse* functions still work, so you can put OnMouseDown() code on your objects. If you want a Raycast() solution then you need the 3D Physics.Raycast() and this type of Raycast() requires a 3D collider. You cannot have a 2D and a 3D collider on the same object, but you can put a 3D collider on an empty child object.

If all you need is a position in world space then you can still use Camera.ScreenToWorldPoint().