I have a project which has several mesh objects with primitive collider triggers and a script on them which causes the object to act OnMouseOver. up until yesterday it was fine, but now the objects do not trigger onmouseover unless I position the object on along the right side of the screen when i put the mouse over it for some reason. didnt do anything i can think of which might cause that. reinstalling unity hasn’t helped, but the project works fine on another computer. Also, on the affect computer, if i build and run the executable it works fine, just not if i play it from the editor. anyone seen this before or have any ideas? thanks
I have experience OnMouseDown not responding on an object before but not when it previously did. At that time I found that the ua suggested to use Physica.Raycast because the OnMouse Events have exceptions and are not as reliable.
Interesting, I find also that if i play it in the editor with Maximize on Play, it works correctly. If I don’t maximize on play, it only works if object is near the right edge of screen.
Actually it’s not working fine in maximize on play, but now i can detect onmouseover for anything on the right side of the camera’s projection on the screen, but not on the left. Any ideas about this?
Well, it’s a very strange problem. Process of elimination didn’t produce any results. So I implemented a raycast check instead of using OnMouseOver, as you suggested, and at least it is working correctly. Thanks!
It sounds like you solved the problem using a Raycast, but I’ve recently had a very similar experience that’ll hopefully make things easier.
I discovered that my problem was caused by the target instances having several, almost exactly overlapping but slightly rotated, sphere colliders.
The prefab had been made from several scaled sphere primitives but I hadn’t adjusted their colliders, so they remained as spheres.
This meant that the parent object’s collider would trigger OnMouseOver from some directions, but not from others.
Being new to Unity it took me a long time to notice this!
Once I’d disabled the child object colliders, or turned them to mesh rather than sphere, the parent object began to respond to OnMouseOver as expected.
Hope that helps, for the future maybe.
Yes it works correctly when in max mode, Thanks…