unity raycast all layers except one code example
Example: unity raycast all layers except one
RaycastHit hit; if (Physics.Raycast(muzzle[muzzleIndex].transform.position, muzzle[muzzleIndex].transform.forward, out hit, range, ~(1 << LayerMask.NameToLayer("Projectile"))))