I’ve been trying to make it so when you press the letter i, the inventory will show up.
I wrote a code that doesn’t give me any errors, but when I press the letter i, the GUI Doesn’t show up
here’s the code:
using UnityEngine;
using System.Collections;
public class GButton : MonoBehaviour {
public Texture2D texture = null;
public float x = 0;
public float y = 0;
public float x2 = 0;
public float y2 = 0;
private bool activeInv = false;
void Update()
{
if (Input.GetKeyDown(KeyCode.I))
{
if (!activeInv)
{
activeInv = true;
}
else
{
activeInv = false;
}
}
}
void onGUI()
{
if (activeInv)
{
GUI.Label(new Rect(x,y, x2,y2), texture);
}
}
}