public bool DrawShipConfigurationManager()
    {
        selectedComponentCategory = GUI.SelectionGrid(new Rect(0, 0, 300, 25), selectedComponentCategory, componentCategories, componentCategories.Length);

        int drawCounter = 0;

        //List of ships
        foreach (Ship ship in unitList.ships)
        {
            if (GUI.Button(new Rect(400, 25 * drawCounter + 30, 200, 25), ship.name))
            {
                currentShipConfiguration.SetShip(ship);
            }

            drawCounter++;
        }

        //configuration name
        if (currentShipConfiguration.ship != null)
        {
            currentShipConfiguration.configurationName = GUI.TextField(new Rect(0, 250, 400, 25), currentShipConfiguration.configurationName);
            GUI.Label(new Rect(600, 275, 400, 25), currentShipConfiguration.ship.name);
            GUI.Label(new Rect(600, 300, 400, 25), "Health: " + currentShipConfiguration.health.ToString());
            GUI.Label(new Rect(600, 325, 400, 25), "Shield: " + currentShipConfiguration.shield.ToString());
            GUI.Label(new Rect(600, 350, 400, 25), "Speed: " + currentShipConfiguration.speed.ToString());
            GUI.Label(new Rect(600, 375, 400, 25), "Turn Speed: " + currentShipConfiguration.turnSpeed.ToString());
        }

        //ship component slots
        drawCounter = 0;
        int weaponSlotCount = 0;
        int hullSlotCount = 0;
        int engineeringSlotCount = 0;
        List<ShipComponentSlot> slots = currentShipConfiguration.GetShipComponentSlots();
        for (int i = 0; i < slots.Count; i++)
        {
            ShipComponentSlot componentSlot = slots[i];
            int xOffset = 0;
            int yOffset = 0;
            string emptySlotLabel = "";

            if (componentSlot.componentType == ShipComponentSlot.ComponentTypes.weapon)
            {
                xOffset = 100 * weaponSlotCount + 500;
                yOffset = 0;
                emptySlotLabel = "W";
                weaponSlotCount++;
            }
            else if (componentSlot.componentType == ShipComponentSlot.ComponentTypes.hull)
            {
                xOffset = 100 * hullSlotCount + 500;
                yOffset = 120;
                emptySlotLabel = "H";
                hullSlotCount++;
            }
            else if (componentSlot.componentType == ShipComponentSlot.ComponentTypes.engineering)
            {
                xOffset = 100 * engineeringSlotCount + 500;
                yOffset = 240;
                emptySlotLabel = "E";
                engineeringSlotCount++;
            }

            Color previousColor = GUI.color;

            if (i == selectedComponentSlot)
            {
                GUI.color = Color.green;
            }

            if (componentSlot.shipComponent != null)
            {
                if (GUI.Button(new Rect(xOffset + 75, yOffset + 400, 25, 25), "X"))
                {
                    currentShipConfiguration.SetShipComponentSlot(i, null);
                    //skip next button draw because shipComponent will become null
                    break;
                }

                if (GUI.Button(new Rect(xOffset, yOffset + 400, 100, 100),  componentSlot.shipComponent.icon))
                {
                    selectedComponentSlot = i;
                }

                GUI.Button(new Rect(xOffset + 75, yOffset + 400, 25, 25), "X"); //button icon for X
            }
            else
            {
                if (GUI.Button(new Rect(xOffset, yOffset + 400, 100, 100),  emptySlotLabel))
                {
                    selectedComponentSlot = i;
                }
            }

            GUI.Label(new Rect(xOffset, yOffset + 500, 100, 100), "---");
            drawCounter++;
            GUI.color = previousColor;
        }
        GUI.Label(new Rect(100, 725, 100, 50), selectedComponentSlot.ToString());

        //List of components
        drawCounter = 0;
        foreach (ShipComponent shipComponent in shipComponentList.shipComponents)
        {
            if ((selectedComponentCategory == 0 && (shipComponent is Weapon || shipComponent is Turret)) ||
                (selectedComponentCategory == 1 && shipComponent is HullComponent))
            {
                int x = drawCounter % 3;
                int y = drawCounter / 3;

                Color previousColor = GUI.color;
                if (!currentShipConfiguration.IsComponentCompatible(selectedComponentSlot, shipComponent))
                {
                    GUI.color = Color.red;
                }

                if (GUI.Button(new Rect(x * 100, y * 100 + 30, 100, 100), shipComponent.icon))
                {
                    currentShipConfiguration.SetShipComponentSlot(selectedComponentSlot, shipComponent);
                }

                drawCounter++;
                GUI.color = previousColor;
            }
        }

        //saved configurations
        if (GUI.Button(new Rect(700, 0, 100, 25), "SAVE CONFIG"))
        {
            SaveConfiguration();
        }
        if (GUI.Button(new Rect(800, 0, 100, 25), "NEW CONFIG"))
        {
            NewConfiguration();
        }

        if (shipConfigurations.Count == 0)
        {
            GUI.Label(new Rect(700, 25, 400, 25), "NO SAVED SHIP CONFIGURATIONS");
        }
        else
        {
            for (int i = 0; i < shipConfigurations.Count; i++)
            {
                if (GUI.Button(new Rect(700, i * 25 + 25, 400, 25), shipConfigurations[i].configurationName))
                {
                    currentShipConfiguration = shipConfigurations[i];
                }
            }
        }

        if (GUI.Button(new Rect(300, 0, 200, 25), "SPAWN SHIP"))
        {
            GameObject shipObject = unitList.GetShipObject(currentShipConfiguration.ship);
            GameObject instance = (GameObject)GameObject.Instantiate(shipObject, new Vector3(0, 0, 0), Quaternion.identity);
            instance.name = "----";

            Ship ship = instance.GetComponent<Ship>();
            ship.LoadConfiguration(currentShipConfiguration);
        }

        if (GUI.Button(new Rect(600, 0, 50, 25), "SAVE"))
        {
            SaveShipConfigurations saveShipConfigs = new SaveShipConfigurations();
            saveShipConfigs.Save(this);
        }

        return false;
    }
    void Awake()
    {
        DontDestroyOnLoad(this);
        this.transform.parent = null;

        shipConfigurationManagerWindow = new Window(new Rect(Screen.width / 2 - 512, Screen.height / 2 - 384, 1024, 768), this.GetInstanceID(), "SHIP CONFIGURATION MANAGER");
        shipConfigurationManagerWindow.AddTab(DrawShipConfigurationManager, "SHIPS");

        SaveShipConfigurations saveConfigs = new SaveShipConfigurations();
        saveConfigs.Load(this);
    }