Hello everyone!
Here is my problem, sorry if this has been already answered, but I can’t find anything that works for me (or that I can understand, super newbie here)
I’m using the standard FPS Controller prefab in my scene, I did a menu that open when I press escape, with two buttons, restart and quit. But I can not interact with them. When I press escape, the menu appears, but the buttons doesn’t work, highlighted neither, and the Player can still move. When I press escape the cursor appears, but disappear as soon as I click anywhere. Same behaviour if I uncheck “Lock Cursor” in FPS Controller inspector except the cursor is always visible.
Is there any way to fix this? Do I need to change anything in FPS Controller script? Or in MouseLook script?
Again i’m very very new so please talk to me like I’m a five years old…
Here is my menu script so far… Maybe something wrong in it also…
using System.Collections;
using System.Collections.Generic;
using UnityEngine.SceneManagement;
using UnityEngine;
public class PauseMenuPerso : MonoBehaviour
{
public static bool GameIsPaused = false;
public GameObject pauseMenuUI;
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(KeyCode.Escape))
{
if (GameIsPaused)
{
Resume();
}
else
{
Pause();
}
}
}
void Resume()
{
pauseMenuUI.SetActive(false);
Time.timeScale = 1f;
GameIsPaused = false;
}
void Pause()
{
pauseMenuUI.SetActive(true);
Time.timeScale = 0f;
GameIsPaused = true;
}
public void RestartGame()
{
Time.timeScale = 1f;
SceneManager.LoadScene(SceneManager.GetActiveScene().name); // loads current scene
Debug.Log("Restarting game...");
}
public void QuitGame()
{
Debug.Log("Quiting game...");
Application.Quit();
}
}
Thanks a lot for your time and help.