/// <summary> /// Record the time has passed. /// </summary> public void LateUpdate(float dt) { if (mTimer != null) { if (mNumFrameNeedResize > 0) { if (mGameObject != null && mText.transform.parent != null) { CanvasScaler canvasScaler = MyUGUIManager.Instance.CanvasOnTop.GetComponent <CanvasScaler>(); RectTransform rectTransform = mText.transform.parent.GetComponent <RectTransform>(); if (canvasScaler != null && rectTransform != null) { if (rectTransform.sizeDelta.x > 0) { float limitWidth = canvasScaler.referenceResolution.x * 0.95f; if (rectTransform.sizeDelta.x > limitWidth) { LayoutElement layoutElement = mText.transform.parent.GetComponent <LayoutElement>(); if (layoutElement != null) { layoutElement.preferredWidth = limitWidth; } } } } } mNumFrameNeedResize--; } mTimer.Update(dt); if (mTimer.IsJustDone()) { Hide(); } } }