Unity Raycast все слои, кроме одного
RaycastHit hit = Physics2D.Raycast(position, direction,
range, ~(1 << LayerMask.NameToLayer("Player"))))
Plimpton
RaycastHit hit = Physics2D.Raycast(position, direction,
range, ~(1 << LayerMask.NameToLayer("Player"))))