using System; using System.Collections; using System.Collections.Generic; using UnityEngine; public class Coin : MonoBehaviour, IItem { public static event Action OnCoinCollect; public int worth = 5; public void Collect() { OnCoinCollect?.Invoke(worth); // Added null check for safety SoundEffectManager.Play("Coin"); Destroy(gameObject); } }