Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class CanvasSwitch : MonoBehaviour {
- public Canvas HUD;
- public Canvas Inventory;
- bool temp = false;
- // Use this for initialization
- void Start () {
- HUD.GetComponent<Canvas>().enabled = true;
- Inventory.GetComponent<CanvasSwitch>().enabled = false;
- }
- // Update is called once per frame
- void Update () {
- if(Input.GetKeyDown(KeyCode.I) && temp == false)
- {
- HUD.GetComponent<Canvas>().enabled = true;
- Inventory.GetComponent<Canvas>().enabled = false;
- }
- if(Input.GetKeyDown(KeyCode.I))
- {
- Inventory.GetComponent<Canvas>().enabled = !Inventory.GetComponent<Canvas>().enabled;
- temp = true;
- }
- }
- void EnableInventory()
- {
- HUD.GetComponent<Canvas>().enabled = false;
- Inventory.GetComponent<Canvas>().enabled = true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement