private void OnTriggerEnter(Collider other) { if (((1 << other.gameObject.layer) & autoOpen) == 0) { return; } Opener opener = other.transform.GetComponent <Opener>(); opener?.SetOpenState(true); }