- Home /
Check if GUI.Button Location is....(javascript)
I am using a multiplier to add buttons to my Inventory. Heres my GUI.Button line of code
for(var x = 0; x < MainInventory.Count; x++) { //
if(GUI.Button(Rect(30,30 + 25 + (20 * x), 100, 20), "" + MainInventory[x].Name)) {
This tells the game if I have 5 Inventory slots then Inventory 2 is Inventory 1 * 20 on the x axis. My Question is, How do I tell javascript to do a position check incase my Inventory slot is say y = 200 then start a new row at x 200 ? My buttons are 100,20 "100 x and 20 y"
It's confusing but I followed the Jesse Etzler tutorials on Advanced Inventories and He didn't really specify a Boundaries for Inventory buttons. I want to make my inventory a maximum of 40 buttons (slots) but I want 5 rows wide and 8 rows long. I know there is a "Grid" option but that's too complicated for when I equip armor it keep messing up.
Your answer
![](https://koobas.hobune.stream/wayback/20220613135044im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
When I restart the level, everything doesn't move 2 Answers
Hide/show GUI Buion 1 Answer
Button help 1 Answer
Locking levels on a level map? 1 Answer
Strange InputManager Problem 1 Answer