- Home /
Question by
raycosantana · Oct 03, 2013 at 02:09 PM ·
guibuttonsgamepad
Control script generated buttons with a Gamepad
How can I control script generated buttons with a gamepad? until today I have been using GUI.FocusControl(MenuString);
in combination of an int switch to move through the different menu buttons the problem is that method requires to know before hand how many buttons are there so it doesn't work with buttons generated by a script for example this code I have to display the items in inventory:
if (MenuString == "Items"){
for (int y = 0; y < _rows; y++ ){
for (int x = 0; x < _cols; x++ ){
GUI.Box (new Rect(x*(Screen.width/15),y * (Screen.height / 8.5f), Screen.width/15 ,Screen.height / 8.5f),new GUIContent (InventoryScript.itemsInInventory[x + y * _cols].Icon));
GUI.Label (new Rect(x*(Screen.width / 2f),y*(Screen.height/ 4)*0.25f, Screen.width/15 ,Screen.height / 8.5f)," " + InventoryScript.itemsInInventory[x + y * _cols].Cantidad,InventoryStile);
}
}
}
How can I do this?
Thanks!
Comment
Your answer
Follow this Question
Related Questions
How will i develop the type of gui? 0 Answers
My OnGUI() Won't show the Button elements :( 0 Answers
Is there a way to combine the Update and OnGUI functions? 1 Answer
XBox 360 controller for the GUI 1 Answer
Determining GUI button pressed 2 Answers