Hi guys, i’m creating an inventory, and i’m having a problem, my inventory won’t stay open, if i let go of the key “c” Then it’ll disappear, it’s anoiying, because too use the inv you have to hold the “c” key, i wan’t it to toggle, so if the key has been pushed it stays open until its pushed again. Also how would i get it to go into the exact centre, for all resolutions, because on my 1360 x 768 Monitor if i have screen width / 2 it goes to the right.
#pragma strict
var InventoryEnabled = false;
var InvWindow : Texture;
var InvClose : Texture;
function Update () {
if (Input.GetKey("c"))
{
InventoryEnabled = true;
}else
{
InventoryEnabled = false;
}
}
function OnGUI ()
{
if(InventoryEnabled == true)
{
GUI.Box(Rect(Screen.width /2 - 280,Screen.height /2 - 200 ,500,350), "Inventory");
}
}