void OnDisable()
    {
        if (unitListWindow != null)
        {
            unitListWindow.Close();
            unitListWindow = null;
        }
            
        if (atkListWindow != null)
        {
            atkListWindow.Close();
            atkListWindow = null;
        }

        if(maskWindow != null)
        {
            maskWindow.Close();
            maskWindow = null;
        }
            
    }
    /************************************/
    //TYPE DEPENDANT SHOWING
    /************************************/

    /*****UNITS*********************************/

    void showUnitCardInfo()
    {
        //Filter the desired creature type
        List<UnitData> unitsInList = new List<UnitData>();
        List<String> unitNames = new List<String>();

        foreach(UnitData x in unitDataList.unitList.ToList<UnitData>())
        {
            if(x.uType == filterUnit)
            {
                unitsInList.Add(x);
                unitNames.Add(x.uName);
            }
        }

        
        if(GUILayout.Button("Unit List"))
        {
            unitListWindow = (UnitListWindow)EditorWindow.GetWindow(typeof(UnitListWindow));
        }

        currentUnit = unitDataList.findByID(cardDataList.cardList[toggledIndex].linkedTo);

        GUILayout.Space(10);
        //Associate the correct UnitType, possibly load into current object field
        if (currentUnit != null)
        {
            if (currentUnit.isHero)
                EditorGUILayout.LabelField("Hero Unit");
            EditorGUILayout.LabelField(currentUnit.uName, EditorStyles.boldLabel);
            EditorGUILayout.Space();

            EditorGUILayout.LabelField("Stats");
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("HP");
            EditorGUILayout.TextField(currentUnit.maxHp.ToString());
            //EditorGUILayout.EndHorizontal();

            //EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Speed ");
            EditorGUILayout.TextField(currentUnit.maxSpeed.ToString());
            EditorGUILayout.EndHorizontal();

            if (currentUnit.isHero)
            {
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Impulse ");
                EditorGUILayout.TextField(currentUnit.impulse.ToString());
                //EditorGUILayout.EndHorizontal();

                //.BeginHorizontal();
                EditorGUILayout.LabelField("Memory ");
                EditorGUILayout.TextField(currentUnit.memory.ToString());
                EditorGUILayout.EndHorizontal();
            }

            EditorGUILayout.LabelField("Known Attacks");
            showKnownAttacks(currentUnit);

        }
        else
            EditorGUILayout.LabelField("No Unit Linked", EditorStyles.boldLabel);

    }