using System.Collections; using System.Collections.Generic; using UnityEngine; public class CoinPickup : MonoBehaviour { [SerializeField] int pointsForCoinPickup = 100; void OnTriggerEnter2D(Collider2D other) { if (other.tag == "Player") { FindObjectOfType().AddToScore(pointsForCoinPickup); Destroy(gameObject); } } }