Before the updates my scripts worked perfectly fine, no issues and they executed without a problem. I wanted to learn how to code my pause menu in my UIManager script so that when the pause menu was active, the music would stop playing, so I saw someone’s post about the issue and read another person’s answer that worked and added it to my script, which caused this to appear:
So naturally I backed up my entire folder onto a separate hard drive(as I regularly do) and then gave the okay to go ahead with the update.
After that, I assigned the script again to the NPC but found I got errors, so I opened the script and put the original script in before the edit. Now during test play, I go to pause the game and notices the screen freezes but my pause menu is nowhere to be seen. I close then reopen it without saving and tried again, only for the same issue to occur.
So I got to the canvas for the pause menu and start deactivating each object and playing to find out what’s wrong as I know the script works. After deactivating the buttons and pressing play, my canvas appears once again however my pause menu needs those buttons as they’re pretty vital. The buttons are resume, restart, help, main menu and quit, so I can’t just overlook this serious issue.
This all happened after I updated the API. After spending several days looking around and coming up with nothing, I really, really need help from the community now more then ever.
How do I reverse the API update? Do I download a previous version of Unity or is there something else that I need to do to get this vital script and pause menu working? The UIManager script is in all scenes in my game and in them the script works fine, it loads and plays without a problem, the transitions between scenes are just fine, the main issue is just that the main menu won’t appear when I press the Esc button now unless I uncheck the buttons in the inspector to deactivate them but again those buttons are vital and I need them working.
If it helps, here’s a copy of my UIManager:
using UnityEngine;
using System.Collections;
public class UIManager : MonoBehaviour
{
private GameObject PauseMenu;
// Use this for initialization
void Start()
{
Time.timeScale = 1;
PauseMenu = GameObject.FindGameObjectsWithTag("ShowOnPause");
hidePaused();
}
// Update is called once per frame
void Update()
{
//uses the Esc button to pause and unpause the game
if (Input.GetKeyDown(KeyCode.Escape))
{
if (Time.timeScale == 1)
{
Time.timeScale = 0;
showPaused();
}
else if (Time.timeScale == 0)
{
Debug.Log("high");
Time.timeScale = 1;
hidePaused();
}
}
}
//Reloads the Level
public void Reload()
{
Application.LoadLevel(Application.loadedLevel);
}
//controls the pausing of the scene
public void pauseControl()
{
if (Time.timeScale == 1)
{
Time.timeScale = 0;
showPaused();
}
else if (Time.timeScale == 0)
{
Time.timeScale = 1;
hidePaused();
}
}
//shows objects with ShowOnPause tag
public void showPaused()
{
foreach (GameObject g in PauseMenu)
{
g.SetActive(true);
}
}
//hides objects with ShowOnPause tag
public void hidePaused()
{
foreach (GameObject g in PauseMenu)
{
g.SetActive(false);
}
}
//loads inputted level
public void LoadLevel(string level)
{
Application.LoadLevel(level);
}
//exits game
public void doExitGame()
{
Application.Quit();
}
}
I would appreciate any advice or help on this matter