- Home /
Question by
sdziubek08 · Mar 02, 2021 at 10:08 PM ·
cs
hey i made a pause menu in brackeys and it pauses the game but when i move my cursor the camera follows,i made a pause menu from brackeys but when i hit escape and move my mouse it moves the camera too
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class PAuseMenu : MonoBehaviour { public bool gameispaused = false; public GameObject PauseMenu;
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(KeyCode.Escape))
{
if (gameispaused)
{
Resume();
}
else
{
Pause();
}
}
}
void Resume()
{
PauseMenu.SetActive(false);
Time.timeScale = 1f;
gameispaused = false;
}
void Pause()
{
PauseMenu.SetActive(true);
Time.timeScale = 0f;
gameispaused = true;
}
}
Comment
Your answer
Follow this Question
Related Questions
Making a non player character move forward 3 Answers
Unity crashed and corrupted my .cs file,Electricity went down and corupted a .cs file 3 Answers
broadcasting error for targetting script 3 Answers
Scene loading early problem with position script 1 Answer
JavaScript, lag spammed function call 2 Answers