private void OnTriggerStay2D(Collider2D collision) { if (collision.gameObject.name == "Chest") { Chest chest = FindObjectOfType <Chest>(); if (Input.GetKeyDown(KeyCode.C)) { if (deschis) { chest.CloseChest(); deschis = false; } else { chest.OpenChest(); deschis = true; } } } }