Question by
mrCharli3 · Mar 24, 2018 at 09:57 AM ·
2draycastphysics2dcollission
2D Collission - Raycast mouseposition efficiently
I realized today that you can't really use IPointerDownHandler etc. in a 2D world with depth, because if two colliders overlap (say an NPC is standing in front of a bush with a lower sorting layer) then the pointer doesnt react. So I figure the only way to solve it is using Raycast.
However, how do I do this efficiently? I have hundreds of objects I want to check if my mouse is hovering or clicking. Do I need to raycast my mouse position in all these objects? seems really expensive.
Comment