using UnityEngine; namespace BuffaloSiege { [ExecuteAlways]public class ModalFit:MonoBehaviour { public float preferredHeight=1000; void LateUpdate(){var r=(RectTransform)transform;var parent=r.parent as RectTransform;if(parent)r.sizeDelta=new Vector2(700,Mathf.Min(preferredHeight,Mathf.Max(320,parent.rect.height-40)));} } }