void Update() { if (Time.time - lastChange > interval && Eat == true) { Consume(); lastChange = Time.time; } if (currentIndex == 4) { Debug.Log("rhurhir"); #pragma warning disable CS0618 // Type or member is obsolete DestroyObject(gameObject); #pragma warning restore CS0618 // Type or member is obsolete if (linkedObject.CompareTag("Food")) { Debug.Log("We should be eating"); GameObject.Find("Stats").GetComponent <PlayerStatus>().EatButton(); } else if (linkedObject.CompareTag("Drink")) { GameObject.Find("Stats").GetComponent <PlayerStatus>().DrinkButton(); } } }