I’ve formatted your code, you should do that yourself in the future(paste your code, highlight all of the CODE/SCRIPT and click the 101010 button.
Anywho, Your third if statement in the OnGUI function is nothing, there aren’t any instructions under it(this is a requirement if you don’t use an empty code block as you did in the if statement above(line 20-23).
Try this:
public class InventoryGUI extends InventoryVariables
{
function Update()
{
if(Input.GetKeyDown(KeyCode.I))
{
Defaults.IsOpen = !(Defaults.IsOpen);
}
}
function OnGUI()
{
for(var SD : Slots in InventorySlots)
{
if(SD.HotDetails.IsHotBar)
{
if(GUI.Button(Rect(SD.BoxPosition.x,SD.BoxPosition.y,SD.BoxSize.x,SD.BoxSize.y),""))
{
}
}
else
{
if(Defaults.IsOpen)
{
if(GUI.Button(Rect(SD.BoxPosition.x,SD.BoxPosition.y,SD.BoxSize.x,SD.BoxSize.y),""))
{
// RIGHT HERE, you didn't have an empty block and if missing that, a single statement to invoke
}
}
}
}
}
}