Advertisement
Guest User

Ppauser

a guest
Jan 9th, 2016
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.57 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class Ppauser : MonoBehaviour {
  5.  
  6.     public bool paused = false;
  7.  
  8.  
  9.     void Update()
  10.     {
  11.         if (Input.GetKeyDown(KeyCode.Escape) && paused == false)
  12.         {
  13.             paused = true;
  14.             Cursor.visible = true;
  15.             Cursor.lockState = CursorLockMode.None;
  16.         }
  17.         else if (Input.GetKeyDown(KeyCode.Escape) && paused == true)
  18.         {
  19.             paused = false;
  20.             Cursor.visible = false;
  21.             Cursor.lockState = CursorLockMode.Locked;
  22.         }
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement