Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Escape : MonoBehaviour
- {
- public static bool gameispaused = false;
- public GameObject pauseMenuUI;
- void update()
- {
- Debug.Log("update");
- if (Input.GetKeyDown("l"))
- {
- Debug.Log("Escape is pressed");
- if (gameispaused)
- {
- Debug.Log("Escape is pressed");
- resume();
- }
- else
- {
- Debug.Log("Escape is pressed");
- Pause();
- }
- }
- }
- void resume ()
- {
- pauseMenuUI.SetActive(false);
- Time.timeScale = 1f;
- gameispaused = false;
- }
- void Pause ()
- {
- pauseMenuUI.SetActive(true);
- Time.timeScale = 0f;
- gameispaused = true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement