using UnityEngine; public class ChaseCoin : MonoBehaviour { public int coinValue = 1; void OnTriggerEnter(Collider other) { Debug.Log("ChaseCoin0"); if (other.CompareTag("Player")) { Debug.Log("ChaseCoin"); FindObjectOfType().AddScore(coinValue); Destroy(gameObject); } } }