原理和说明,有空再说的
public float CommonCalChildrenHeight(Transform tran)
{
float height = 0;
for (int i = 0; i < tran.childCount; i++)
{
RectTransform rect = tran.GetChild(i) as RectTransform;
if (rect == null) continue;
//float coordinateY = Math.Abs(rect.rect.y);
float coordinateY = Math.Abs(rect.anchoredPosition.y);
Debug.Log(tran.gameObject.name+ "-当前高度:" + coordinateY);
Debug.Log(tran.gameObject.name + "-锚高:" + rect.anchoredPosition.y);
coordinateY+=CommonCalRealHeight(tran.GetChild(i));
if (coordinateY > height)
height = coordinate