Really don’t need to explain much but basically one script needs to know when the game is over from another script. I have checked all over and I don’t believe I am doing anything wrong but I am still getting an error (null reference exception.) Here is my code:
public bool GameOver;
// Use this for initialization
void Start ()
{
}
// Update is called once per frame
void Update ()
{
Movement movementScript = GetComponent<Movement>();
if(movementScript.GameOver == false)
{
GameOver = false;
}
if(movementScript.GameOver == true)
{
GameOver = true;
}
Debug.Log(GameOver);
if(EscClicked == false && GameOver == false)
{
Didn’t copy the entire script on purpose
And here is the other script:
void OnTriggerEnter(Collider other)
{
GameOver = true;
Camera.mainCamera.transform.position = FinishedCameraPosition;
Camera.mainCamera.transform.rotation = FinishedCameraRotaition;
}
More than enough of this script