Error : Missing GUILayout.EndScrollView/EndVertical/EndHorizontal? UnityEditor.DockArea:OnGUI()

Im following the Adventure game tutorial to build an Inventory, in the tutorial they are only using 4 item slots, I need a few more than that. But when I try to add even one more slot I get the following errors when i try to click on the editor down arrow (on the far right) “for item slot 4”:

All I have done is change the number of slots from 4 to 5:

using UnityEngine;
using UnityEngine.UI;
using System.Collections;

public class Inventory : MonoBehaviour
{
    public Image[] itemImages = new Image[numItemSlots];
    public Item[] items = new Item[numItemSlots];
    public const int numItemSlots = 5;



    public void AddItem(Item itemToAdd)
    {
       
        int id = itemToAdd.id;
        if (items.Length <= id)
            return;
        if (items [id]== null)
        {
            items[id] = itemToAdd;
            itemImages[id].sprite = itemToAdd.sprite;
            itemImages[id].enabled = true;
            return;
        }


       
    }



   public void RemoveItem(Item itemToRemove)
    {
        for (int i = 0; i < items.Length; i++)
        {
            if (items *== itemToRemove)*

{
items = null;
itemImages*.sprite = null;*
itemImages*.enabled = false;*
return;
}
}
}
}

In case anyone comes here with the same problem.

Adding these two lines in my Inventory Editor code worked for me and allowed me to add 26 numItemSlots! :slight_smile:

public override void OnInspectorGUI()
    {
        serializedObject.Update();
 
        itemImagesProperty.arraySize = Inventory.numItemSlots;
        itemsProperty.arraySize = Inventory.numItemSlots;
 
        for (int i= 0; i < Inventory.numItemSlots; i++)
        ...