If I add a button to my pause menu, it doesn't show up?
Okay this is pretty weird. My pause menu worked perfectly before and had 5 buttons: resume, help, restart, main menu and quit and all worked just fine. The Unity asked me if I wanted to update and said I should do a back up, so I did that, then went back to test my game only to find that the pause menu I made suddenly won't show up.
So I went to the pause menu and checked the script, thinking that might be the issue as I tried(and failed) to program the BG music to stop playing once paused. That wasn't the problem. So I started unchecking things to see if that was it and apparently it's the buttons.
I have a UIManager script in C# attached to them and it works fine(as I check my main menu, help menu and loading screen and all work properly) however if I enable the buttons, the pause menu won't show up however the game will still pause, it just looks like the screen is frozen until you unpause it.
I'll upload some screenshots of the settings and a copy of my UIManager script as I sincerely have no clue as to why it's suddenly doing this now.
UIManager C# script:
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);
}
}
And here's screenshots of the inspector for the buttons:
I'm seriously stuck on this and I would greatly appreciate some advice, even if it's something completely obvious that I've missed, I just need to get this pause menu working again :(
Your answer
![](https://koobas.hobune.stream/wayback/20220612105128im_/https://answers.unity.com/themes/thub/images/avi.jpg)