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

public static class UGUIExtension
{
    /// <summary>
    /// 刷新布局
    /// </summary>
    public static void RefreshLayout(this GridLayoutGroup gridLayout)
    {
        gridLayout.CalculateLayoutInputHorizontal(); //添加子rect到集合 内部只做了水平的集合更新 垂直布局原理也是根据水平数据实现的
        if (gridLayout.startAxis == GridLayoutGroup.Axis.Vertical) //根据轴向排版
        {
            gridLayout.SetLayoutVertical();
        }
        else
        {
            gridLayout.SetLayoutHorizontal();
        }
    }
}