using System; using UnityEngine; using UnityEngine.UI; namespace UnityTest.ZXL { public class RefreshLayout : MonoBehaviour { private RectTransform rect; private void Awake() { rect = GetComponent(); } private void Update() { Refresh(); } private void Refresh() { LayoutRebuilder.ForceRebuildLayoutImmediate(rect); } } }