So my current code is:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class EndGame : MonoBehaviour {
void Update() {
if (GameObject.FindWithTag ("Enemy") == null) {
Debug.Log ("No Enemy");
OnGUI();
}
}
void OnGUI() {
GUI.Label( new Rect(Screen.width/2 -50, Screen.height/2 -25, 100, 50), "Congratulations, you won! Restart the game!");
}
}
But when I try to run it, I get this error:
UnityException: Tag: Enemy is not defined.
UnityEngine.GameObject.FindWithTag (System.String tag) (at C:/buildslave/unity/build/Runtime/Export/GameObject.bindings.cs:194)
EndGame.Update () (at Assets/Scripts/EndGame.cs:8)
I’m really stuck on this, it’s my first game, help pls.
Thanks!
