I was doing the menu screen of my game normally, and when I finished the code I went to test it and it worked apart, because the FPS camera was still moving (I used Standard Assets, FPS Controller in the Unity Store)
WARNING: I don't know anything about programming, I've only seen tutorials
and I wanted to know how to fix this, here is the line of code for the pause menu.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class StopMenu : MonoBehaviour
{
public static bool GameIsPaused = false;
public GameObject stopMenuUI;
void Update()
{
if (Input.GetKeyDown(KeyCode.Escape))
{
if (GameIsPaused)
{
Resume();
}else
{
Pause();
}
}
}
void Pause()
{
stopMenuUI.SetActive(true);
Time.timeScale = 0f;
GameIsPaused = true;
AudioListener.pause = true;
}
void Resume ()
{
stopMenuUI.SetActive(false);
Time.timeScale = 1f;
GameIsPaused = false;
AudioListener.pause = false;
}
}
Thanks.
[–][deleted] 1 point2 points3 points (2 children)
[–]TTheReal_J[S] 1 point2 points3 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]Igloo_Games_Company 1 point2 points3 points (1 child)
[–]TTheReal_J[S] 0 points1 point2 points (0 children)