I’m tryning to end my game when the player get to a specific place in my game.
I have tried with OnTriggerEnter but doesn’t work for me. (I’m a beginner)
Here is my scipt (I have only included my code for the ‘end-game’) - I do not get any alerts in my game but nothing happens either.
public class BSs : MonoBehaviour {
public GameObject EndGame;
public GUIText scoreText;
public GUIText endOfGameText;
private bool endOfGame;
void Start (){
endOfGame = false;
endOfGameText.text = “”;
score = 0;
Debug.Log (score);
UpdateScore ();
}
public void GameOver()
{
endOfGameText.text = "GAME OVER";
Debug.Log ("gotya");
}
void OnTriggerEnter (Collider endgame){
if (endgame.gameObject.tag == "Player") {
endOfGame = true;
GameOver();
Application.LoadLevel(Application.loadedLevel);
Debug.Log ("finito");
//audio.Play();
}
}
Thanks in advance for your time!!!