HansE73

MenuManager

Nov 18th, 2018
210
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.67 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class MenuManager : MonoBehaviour
  6. {
  7.     // Changed to GameObject because only the game object of the menu needs to be accessed, you can
  8.     // change this to any class that inherits MonoBehaviour
  9.     public GameObject Rig_Menu;
  10.  
  11.     // Update is called once per frame
  12.     void Update()
  13.     {
  14.         // Reverse the active state every time escape is pressed
  15.         if (Input.GetKeyDown(KeyCode.Escape))
  16.         {
  17.             // Check whether it's active / inactive
  18.             bool isActive = Rig_Menu.activeSelf;
  19.  
  20.             Rig_Menu.SetActive(!isActive);
  21.         }
  22.     }
  23. }
Advertisement
Comments
  • User was banned
Add Comment
Please, Sign In to add comment