Advertisement
Guest User

Inventory

a guest
Jan 9th, 2022
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.58 KB | None | 0 0
  1. using UnityEngine;
  2.  
  3. public class Inventory : MonoBehaviour
  4. {
  5.  
  6.     public GameObject Inventar;
  7.     private bool IsInvOpen;
  8.  
  9.     void Start()
  10.     {
  11.         Inventar.SetActive(false);
  12.         IsInvOpen = false;
  13.     }
  14.  
  15.     void Update()
  16.     {
  17.         if (Input.GetKeyDown(KeyCode.Q))
  18.         {
  19.              if (!IsInvOpen)
  20.             {
  21.                 Inventar.SetActive(true);
  22.                 IsInvOpen = true;
  23.             }
  24.             else
  25.             {
  26.                 Inventar.SetActive(false);
  27.                 IsInvOpen = false;
  28.             }
  29.         }
  30.     }
  31.  
  32. }
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement