Ignore one layermask question

First time trying to use layermasks, am I doing it right? It doesn’t appear to be working. I want the enemy to be able to locate the player even through other enemies but not through walls and other things on the default layer.

    void Update ()
    {
        RaycastHit hit;
        Vector3 rayDirection = player.transform.position - transform.position;
        if(Physics.Raycast(transform.position, rayDirection, out hit, 1<<LayerMask.NameToLayer("Enemy")))
        {
            if(hit.transform.tag == "Player")
            {
                Debug.Log("Hit Player");
            }
        }
	}

int layerMask =~ LayerMask.GetMask(“Enemy”);

Physics.Raycast(...,LayerMask);

LayerMasks are in binary, and the =~ (~= ?) opperator inverts a binary number. You’d get the opposite, meaning hitting everything but the enemy.