- Home /
Pause Menu Text Not Rendering
So I think I might know why this is happening but I'm not sure.
I've basically got two scripts. One for the Pause function and then one for the resume button. The Pause script toggles a boolean within the Resume script which is meant to allow the 3D text "Resume" to display on screen when the game is paused. Not my suspicion is that this isn't happening because when I set the timescale to 0 my presumption is that none of the scripts update. But I'm not sure if this is true or how to get round it and have a functioning pause menu!
Pause Script:-
public class pause : MonoBehaviour {
public bool paused;
public GameObject Resume;
private resumebutton rB;
// Use this for initialization
void Start () {
rB = Resume.GetComponent<resumebutton> ();
paused = false;
Screen.lockCursor = true;
Time.timeScale = 1;
}
// Update is called once per frame
void Update () {
if (paused == true) {
rB.isPaused = true;
} else {
rB.isPaused = false;
}
if (Input.GetKeyDown (KeyCode.Escape)) {
paused = togglePause ();
}
}
bool togglePause()
{
if(Time.timeScale == 0){
GameObject.Find("Capsule").GetComponent<MouseLook>().enabled = true;
Screen.lockCursor = true;
Time.timeScale = 1;
return(false);
}
else{
GameObject.Find("Capsule").GetComponent<MouseLook>().enabled = false;
Screen.lockCursor = false;
Time.timeScale = 0;
return(true);
}
}
}
Resume Button Script:-
public bool isResume = false;
public bool isPaused = false;
public AudioClip click;
void OnMouseEnter() {
if (renderer.enabled == true) {
audio.PlayOneShot (click);
}
renderer.material.color = Color.red;
// isButton = true;
}
void OnMouseExit() {
renderer.material.color = Color.white;
//isButton = false;
}
void OnMouseDown() {
if (isResume) {
GameObject.Find("Capsule").GetComponent<MouseLook>().enabled = true;
Screen.lockCursor = true;
Time.timeScale = 1;
//return(false);
}
}
// Update is called once per frame
void Update () {
if (isPaused == true) {
renderer.enabled = true;
} else {
renderer.enabled = false;
}
}
}
I've had similar issues in the past, check the font, sometimes it resets to none and you have to reselect Arial in the inspector for the component.
Your answer
Follow this Question
Related Questions
Bool wont change... #C 1 Answer
How do i have a pause after i resume game C# 6.4 0 Answers
Multiple Cars not working 1 Answer
Is It Bad To Have Your Jump In Update()? 3 Answers
Time goes to fast for the code. (C#) 2 Answers