Trying to make a game over screen appear when what the script is attached to hits the player. Not sure why its not working, but I’m very new so I’m prolly missing something big.
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using UnityEngine;
using UnityEngine.UI;
public class GameOverUI : MonoBehaviour
{
public GameObject EndGame;
void start ()
{
EndGame.SetActive (false);
}
void OnTriggerEnter(Collider player)
{
if (player.gameObject.tag == "player")
{
EndGame.SetActive(true);
}
}
void OnTriggerExit(Collider player)
{
if (player.gameObject.tag == "Player")
{
EndGame.SetActive(false);
}
}
}
,Trying to make my game over screen appear when 2 objects interact (player and what the script is attached to). but usually nothing ends up happening, its not a compiler error but I’m not sure whats wrong with the code. I could be writing the entirely wrong thing tho lmao I’m very new to this.
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using UnityEngine;
using UnityEngine.UI;
public class GameOverUI : MonoBehaviour
{
public GameObject EndGame;
void start ()
{
EndGame.SetActive (false);
}
void OnTriggerEnter(Collider player)
{
if (player.gameObject.tag == "player")
{
EndGame.SetActive(true);
}
}
void OnTriggerExit(Collider player)
{
if (player.gameObject.tag == "Player")
{
EndGame.SetActive(false);
}
}
}