- Home /
JavaScript Grid Array Size
EDIT!
Hi guys, i'm creating a inventory for my game and i have a grid size, i have created an array so that the texture applies to all grids, and i can choose how many boxes are in a grid. One problem is that i want to be able to set the size in between each box, they all look a little clustered together, any help? BTW Code sample isn't working for me.
pragma strict
var InventoryEnabled = false;
var InvWindow : Texture; var InvClose : Texture; var Grids : Texture[]; var SideBar : Texture[];
private var GridValue : float = -1;
function Update(){
if(Input.GetKeyDown("c")){ if(InventoryEnabled == true){ InventoryEnabled = false; Time.timeScale = 1; AudioListener.volume = 1; Screen.showCursor = false; GetComponent(MouseLook).enabled = true; } else if(InventoryEnabled == false){ InventoryEnabled = true; AudioListener.volume = 0; Time.timeScale = 0; Screen.showCursor = true; GetComponent(MouseLook).enabled = false; } } }
function OnGUI () {
if(InventoryEnabled == true) { GUI.Box(Rect(Screen.width /2 - 280,Screen.height /2 -280 ,650,500), InvWindow); //Grid GridValue = GUI.SelectionGrid(Rect(Screen.width / 2 - 210, Screen.height / 2 - 200, 500, 200), GridValue, Grids, 4);
//Side Bars } }
Your answer
![](https://koobas.hobune.stream/wayback/20220613083212im_/https://answers.unity.com/themes/thub/images/avi.jpg)