Vladkiber

Влад

Mar 31st, 2020
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.60 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class Pause : MonoBehaviour
  6. {
  7.  
  8.     public bool IsPaused;
  9.  
  10.     public GameObject PauseMenu;
  11.  
  12.    
  13.     void Start()
  14.     {
  15.  
  16.     }
  17.  
  18.      
  19.     void Update()
  20.     {
  21.  
  22.         if (IsPaused)
  23.         {
  24.             PauseMenu.SetActive(true);
  25.             Time.timeScale = 0f;
  26.         }
  27.         else
  28.         {
  29.             PauseMenu.SetActive(false);
  30.             Time.timeScale = 1f;
  31.         }
  32.  
  33.  
  34.         if (Input.GetKeyDown(KeyCode.Escape))
  35.         {
  36.             IsPaused = !IsPaused;
  37.         }
  38.     }
  39. }
Add Comment
Please, Sign In to add comment