private void OnTriggerEnter2D(Collider2D collision) { if(collision.gameObject.tag == "Box") { if(collision.gameObject.transform.position.y > this.transform.position.y) { lever.switchedOn = false; lever.ToggleSwitch(); } if (collision.gameObject.transform.position.y < this.transform.position.y) { lever.switchedOn = true; lever.ToggleSwitch(); } } }