private IEnumerator RunTweenWithDelay(Tweenable tweenable, bool toIn, float delay) { if (tweenable.DelayMode == DelayModes.Both || tweenable.DelayMode == DelayModes.InOnly && toIn || tweenable.DelayMode == DelayModes.OutOnly && !toIn) { yield return(new WaitForSecondsRealtime(delay)); } tweenable.TweenToState(toIn); }
void Update() { // Wait for the content to init before doing runtime size change checks. if (!_isInited) { return; } // If the content changes size, also animate to the new size. if (Target is VerticalLayoutGroup) { if (_previousPreferredSize != Target.preferredHeight) { _previousPreferredSize = Target.preferredHeight; // Force tweenable to update. if (_tweenable.State != TweenableState.BetweenToIn && _tweenable.State != TweenableState.BetweenToOut) { _tweenable.TweenToState(_tweenable.State == TweenableState.In); } } } else if (Target is HorizontalLayoutGroup) { if (_previousPreferredSize != Target.preferredWidth) { _previousPreferredSize = Target.preferredWidth; // Force tweenable to update. if (_tweenable.State != TweenableState.BetweenToIn && _tweenable.State != TweenableState.BetweenToOut) { _tweenable.TweenToState(_tweenable.State == TweenableState.In); } } } }