So this is my current script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class EndGame : MonoBehaviour {
void OnGUI() {
if (GameObject.FindWithTag ("Enemy") == null) {
Debug.Log("Enemy not found");
GUI.Label( new Rect(Screen.width/2 -50, Screen.height/2 -25, 100, 50), "Congratulations, you won! Restart the game!");
}
}
}
And it works when i play it in the editor, but when i build the game and run the executable. It just shows Congratulations, you won! Restart the game! continuously. It shouldn’t do that.
Please help!
Thanks!