Alright quick question. I tried looking around first and I am either dumb and don’t know how to implement something, or something else is wrong. So I attempted to give my game the ability to pause, and for the most part I was successful. My only problem now is the camera still moves when the game is paused. I know that I am supposed to find the first person camera script and disable it but everything I try throws up errors. Here is my script so far without any of my attempts to fix the camera.
// Use this for initialization
void Start ()
{
}
void Update ()
{
if (!isPaused)
{
if (Input.GetKeyDown(KeyCode.Escape))
{
pause();
}
}
else
{
if (Input.GetKeyDown(KeyCode.Escape))
{
pause ();
}
}
}
void pause ()
{
if (!isPaused)
{
isPaused = true;
Time.timeScale = 0;
}
else
{
isPaused = false;
Time.timeScale = 1;
}
}
void OnGUI()
{
if (isPaused)
{
GUI.skin = boxSkin;
GUI.Label(new Rect(500,175,200,55), "Paused");
}
}
}
nevermind, i figured it out, i just added a second script for the camera, because it turns out the controller mouselook controls up and now and the camera mouselook controls left and right. I then added ‘GetComponent().enabled = false;’ to both scripts and ‘GetComponent().enabled = true;’ on the else. I also removed the gui component on the camera so I didn’t get Two pause words.