Question by
ifswda6 · Jan 01, 2020 at 10:44 PM ·
c#menumenu screen
Game starts with pause menu activated
that's it. I used this tutorial https://www.youtube.com/watch?v=JivuXdrIHK0 to make a pause menu, but when I test the game the program starts in the pause menu, also locks the mouse movement so I can't press any button. what could be missing?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MenuPausa : MonoBehaviour
{
public static bool GameIsPaused = false;
public GameObject pauseMenuUI;
void Update()
{
if (Input.GetKeyDown(KeyCode.Escape))
{
if (GameIsPaused)
{
Resume();
}
else
{
Pause();
}
}
}
public void Resume()
{
pauseMenuUI.SetActive(false);
Time.timeScale = 1f;
GameIsPaused = false;
}
void Pause()
{
pauseMenuUI.SetActive(true);
Time.timeScale = 0f;
GameIsPaused = true;
}
public void LoadMenu ()
{
Debug.Log("Loading menu...");
}
public void QuitGame()
{
Debug.Log("Quitting game...");
Application.Quit();
}
}
Comment
Answer by Triggerly · Jan 01, 2020 at 11:30 PM
In your Hierarchy, set your Panel of inactive.
Cool, it worked. thanks but the mouse keeps locked, so still can't access to buttons
You could also just do it inside a start method.
void Start()
{
Resume();
}
Your answer
Follow this Question
Related Questions
Writing dropdown selections to file 1 Answer
Add an Icon next to a text inside a button Unity 5.6 1 Answer
Options menu won't work 0 Answers
add button to switch cars 1 Answer
Unity coding problem 1 Answer