- Home /
is it possible to make OnMouseEnter work through another object?
I recently changed my fog of war in my game. This process meant that where before i was using OnMouseEnter to do all my interaction, there is now a fog of war collider between the mouse and all other objects... is it possible to still get OnMouseEnter to function? ie to make it ignore the fog of war collider and still sense that the mouse is above it?
If not i'll have to rewrite my code to use physics.raycast but if it is possible to keep OnMouseEnter it's going to save me hours of rewriting functions.
Many thanks in advance.
Answer by TonyLi · Feb 25, 2014 at 02:29 PM
Set your fog of war's layer to Ignore Raycast. Also, do you really need a collider for fog of war?
Then again, it makes sense for the fog of war to block OnMouseEnter. The player shouldn't be able to mouse over units that he can't see.
I cant really do that as the reason the fog of war has a collider is to check raycasts from objects. It wont matter for things he can't see it's only relevant for things he can see, even though the alpha on the fog of war is set to 0 over an owned unit, the collider still exists there, and so blocks On$$anonymous$$ouseEnter.
actually the reason for using raycasts on the fog of war before was because of a problem which i since resolved without realizing, so i may be able to ditch the FoW collider after all, thanks lol.