public void OnTriggerEnter2D(Collider2D other) { if (active) { //Debug.Log("Trigger entered"); if (!other.CompareTag("Player")) { return; } Debug.Log("Key collected"); exit.AddKey(); active = false; spriteRenderer.enabled = false; audioSource.Play(); } }