- Home /
Ignoring Layer for OnMouseEnter/OnMouseExit
Hello,
i am using a Script built around OnMouseEnter/OnMouseExit on each Cube of a large Grid. On some of these cubes there are objects with colliders. Now the OnMouseEnter/OnMouseExit functions on the Cubes trigger some RayCasts that are to collide with the objects on the cubes.
The problem i have is that the colliders of the objects partly block the OnMouse-Functions of the cubes. Putting the Objects in the IgnoreRaycasts-Layers is not an option, because of the Raycasts i stated above.
Currently i am disabling the colliders of each object on a cube when the mouse hovers over that cube. That eliminates the problem for the one object on the Cube (which is irrelevant for the Raycasts in that moment), but the problem remains for other objects rendered partly in front of that cube. I can not disable their colliders at the same time because they are crucial for the thing to work.
So the question is: Is it possible to make OnMouse-Functions ignore Layers?