using System.Collections; using System.Collections.Generic; using UnityEngine; public class HeightFixer : MonoBehaviour { public void FixHeight() { ((RectTransform)transform).SetHeight(TotalHeight); } public float TotalHeight { get { float totalChildrenHeight = 0.0f; foreach (RectTransform tform in transform.GetChilds()) { totalChildrenHeight += tform.GetHeight(); } return totalChildrenHeight + 15; } } //private void Update() //{ // FixHeight(); //} }