// Update is called once per frame void Update() { if (greenCube == true && Input.GetKeyDown(KeyCode.Return)) { my_RM.AddGreenItem(); doRefForCane = true; GetComponent <BoxCollider2D>().enabled = false; GetComponent <SpriteRenderer>().enabled = false; soundCollect.Play(); Destroy(gameObject, 1f); } }