using UnityEngine; public class Food : MonoBehaviour { [SerializeField] private int score = 10; Health health; void Start() { health = GetComponent(); health.OnDeath += OnDeath; } void OnDeath() { GameManager.Instance.AddScore(score); gameObject.SetActive(false); } }