detecting enemies standing on blocks
Use Physics2D box casting or overlap checks with layer masks to detect enemies above hit blocks, passing correct output types.
- A member needed to detect and hit an enemy standing on top of a block when the player hits the block from below
- Using Physics2D queries like BoxCast or OverlapBox with an upward direction is recommended over custom dot product tests
- Layer masks should be used instead of tags to filter collision queries specifically for enemies or players
- When calling TryGetComponent on a RaycastHit2D result, target its transform and provide a correctly typed out variable instead of reusing the hit variable


