private void OnTriggerEnter2D(Collider2D other) { if (other.GetComponent <CharacterMovement>() == null) { return; } KeysScript.AddPoints(pointsToAdd); coinSoundEffect.Play(); Destroy(gameObject); }
// Use this for initialization void Start() { PlayerKeysScript = player.GetComponent <KeysScript>(); }