Mouse pressed

I wanted to be fancy and use OnMouseDown() function instead of “if (Input.GetMouseButtonDown(0))” but this event is not firing despite the floor having a mesh collider.
Any idea why?

OnMouseDown() will only fire on scripts that are on the same GameObject that the mouse is over.

Aaah, duh, of course. Thanks a lot!

Hey, that’s not immediately obvious. It is a handy method, though, for doing something like having a Unit announced that it’s been selected, and passing that on to the Unit Action System… good for say… targeting?

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms