- Home /
Question by
nicoolsen10 · Mar 21, 2019 at 09:47 PM ·
gamefreeze
Freeze camera on pause
So im trying to make it so when i pause the game the camera freeze but i can't get it to work here is the script i use to pause the game
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class PauseMenu : 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;
}
}
Comment
Your answer
Follow this Question
Related Questions
Unity freezes tab on Chrome 0 Answers
Unity 4.6 Freeze after launch game 0 Answers
getting udp package info inside unity (GlovePIE) 0 Answers
how do I create a freeze blast 0 Answers
AI Slowing Down Game 0 Answers