using UnityEngine;
using System.Collections;
public class PauseMenu : MonoBehaviour {
public GameObject PauseUI;
private bool paused = false;
void start()
{
PauseUI.SetActive (false);
}
void update()
{
if(Input.GetButtonDown("Pause"))
{
paused = !paused;
}
if(paused)
{
PauseUI.SetActive (true);
Time.timeScale = 0;
}
if(!paused)
{
PauseUI.SetActive (false);
Time.timeScale = 1;
}
}
public void Resume ()
{
paused = false;
}
public void Restart ()
{
Application.LoadLevel (Application.loadedLevel);
}
public void Quit ()
{
Application.Quit ();
}
public void MainMenu ()
{
Application.LoadLevel (0);
}
}
are you expecting unity to call
– gjfstart()orupdate()? it won't.Start()andUpdate()on the other hand...Line 38 -
– SnStarrif(nameToCheck == x.name)is throwing the error NullReferenceException: Object reference not set to an instance of an object GameManager.CheckRayCast () (at Assets/Scripts/Controller/GameManager.cs:66) GameManager.Update () (at Assets/Scripts/Controller/GameManager.cs:24) Yet the Debug.Log that should happen only after that statement is true...Is displying correctly. ALso, no, I am not destroying the Game Object.. Also.. The game objects in the array of game objects are defined.They are original items not instantiated prefabs.