void DrawAbilityButtons()
    {
        List <UnitAbility> list = selectedUnit.unitAbilityList;

        float windowSize = (list.Count - 1) * 65;
        int   startX     = Screen.width / 2 - (int)(windowSize / 2) - 30;

        //int startX=70;
        int startY = Screen.height - 65;
        int height = 60; int width = 60;

        for (int i = 0; i < list.Count; i++)
        {
            if (selectedUnit == null)
            {
                return;
            }

            Texture icon   = null;
            int     status = selectedUnit.IsAbilityAvailable(i);
            if (status == 0 || status == 7)
            {
                icon = list[i].icon;
            }
            else
            {
                icon = list[i].iconUnavailable;
            }

            Rect buttonRect = new Rect(startX, startY, width, height);
            if (selectedID == i)
            {
                buttonRect = new Rect(startX - 3, startY - 3, width + 6, height + 6);
            }

            GUIContent cont = new GUIContent(icon, i.ToString());
            GUI.skin.button.alignment = TextAnchor.MiddleRight;
            if (GUI.Button(buttonRect, cont))
            {
                OnAbilityButton(i);
            }
            GUI.skin.button.alignment = TextAnchor.MiddleCenter;

            //add an AP label
            GUI.Label(new Rect(startX + 20, startY + 18, width, height), "" + list[i].cost, styleA);
            startX += width + 5;
        }
    }