OncollSionenter Layermask

public LayerMask layerMask;

private void OnTriggerEnter(Collider other)
{
    if (((1 << other.gameObject.layer) & layerMask) != 0)
    {
        // Do stuff
    }
}