private void OnTriggerStay(Collider other) { if (other.tag == "Player") { if (Input.GetKeyDown(KeyCode.E) || Input.GetButtonDown("Action")) { Player player = other.GetComponent <Player>(); if (player != null) { player.hasCoin = true; } //Use Camera.main.transform.position if sound is too low AudioSource.PlayClipAtPoint(_coinPickUpAudioClip, this.transform.position, 1.0f); Destroy(this.gameObject); UI_Manager uiManager = GameObject.Find("Canvas").GetComponent <UI_Manager>(); if (uiManager != null) { uiManager.AddCoinToInventory(); } } } }