I’ve got the following code:
var layerMask : int = 1 << LayerMask.NameToLayer("Map");
var hit: RaycastHit2D = Physics2D.Raycast(castPt, -Vector2.up, layerMask);
if (hit != null) {
print("collided with " + hit.collider.name + " on layer " + hit.collider.gameObject.layer);
}
This should make the ray ignore anything that isn’t on the layer “Map” (which is layer 10), correct? When I run I get the following log:
collided with Player on layer 8
why is this happening? Thanks