Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- public class Pausegame : MonoBehaviour {
- private bool Pause = false;
- public Transform canvas;
- void Start () {
- }
- void Update () {
- if(Input.GetKeyDown(KeyCode.P))
- if (canvas.gameObject.activeInHierarchy == false)
- {
- canvas.gameObject.SetActive(true);
- Time.timeScale = 0;
- GameObject.Find("Player").GetComponent<Player>().enabled = false;
- }
- else
- {
- canvas.gameObject.SetActive(false);
- Time.timeScale = 1;
- GameObject.Find("Player").GetComponent<Player>().enabled = true;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement