#pragma strict
//Inventory script
//Inspector var
var mySkin : GUISkin;
var inventoryWindowHeight : float = 90;
var buttonWidth : float = 40;
var buttonHeight : float = 40;
var closeButtonWidth : float = 20;
var closeButtonHeight : float = 20;
//Private var
var _displayInventory : boolean = false;
var _offset_ : float = 10;
private var _inventoryWindowID : int = 0;
private var _inventoryWindowRect : Rect = new Rect(10,10,Screen.height / 2 + 10,Screen.width / 2 - 200);
function Start () {
}
function OnGUI() {
GUI.skin = mySkin;
if (Event.current.Equals (Event.KeyboardEvent ("[enter]")))
_displayInventory = true;
_inventoryWindowRect = GUI.Window(_inventoryWindowID, _inventoryWindowRect, InventoryWindow, " Inventory ");
if (Event.current.Equals (Event.KeyboardEvent ("return")))
print ("Event...");
_displayInventory = false;
}
function InventoryWindow(_inventoryWindowID) {
GUI.skin = mySkin;
GUI.DragWindow();
}
function ToggleInventoryWindow () {
_displayInventory = ! _displayInventory;
}
EventKeyboardEvent and GUI
Page 1 of 11 Replies - 452 Views - Last Post: 09 March 2013 - 10:51 PM
#1
EventKeyboardEvent and GUI
Posted 09 March 2013 - 07:45 PM
Hello could you please help me with my script, i have been trying to make it work for hours now and it's just does not work. I want to have a GUI window appear and disappear on a KeyboardEvent. When i press 'i' inventory will open and close, help me please
Replies To: EventKeyboardEvent and GUI
#2
Re: EventKeyboardEvent and GUI
Posted 09 March 2013 - 10:51 PM
Don't open duplicate topics. Keep it all on one thread. Closing.
Page 1 of 1
|
|

New Topic/Question
This topic is locked



MultiQuote






|