- Home /
MonoBehaviour OnMouseOver does not work with mesh colliders.
I'm making a tile based game, and I want each tile to have detection for when a mouse hovers over them. The object in question has to use a mesh collider, as there are no preset colliders that fit its shape.
One way of doing this is to use raycasts, but that means I would have to account for nulls and would mean a whole lot more work.
The other way of doing this would be to use Monobehaviour.OnMouseOver(). This works perfectly and results in click detection for objects in just a couple of lines of code.
The problem is: OnMouseOver() does not work with mesh colliders, as the mesh collider has to be a model component and can't be a GameObject component.
My question is: Is there a way of making OnMouseOver() work for mesh colliders without putting a script component on the model itself?