private void Start() { var textLabel = typeOn.GetComponent <TextMeshProUGUI>(); lineSize = textLabel.preferredHeight / textLabel.textInfo.lineCount; panelSize = PanelMinSize + lineSize; trans = GetComponent <RectTransform>(); trans.sizeDelta = new Vector2(trans.sizeDelta.x, panelSize); typeOn.JumpLine += () => { StartCoroutine(ScalePanel()); }; }
private IEnumerator StartDelayed() { yield return(new WaitForEndOfFrame()); var textLabel = typeOn.GetComponent <TextMeshProUGUI>(); lineSize = textLabel.preferredHeight / textLabel.textInfo.lineCount; trans = GetComponent <RectTransform>(); panelSize = PanelMinSize + lineSize; trans.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, panelSize); typeOn.JumpLine += () => { StartCoroutine(ScalePanel()); }; }