Beispiel #1
0
        void OnValidate()
        {
            if (!_buttonRectTransformAnimator)
            {
                _buttonRectTransformAnimator = GetComponentInChildren <UIRectTransformAnimator>();
            }

            if (_buttonRectTransformAnimator && _buttonRectTransformSettings)
            {
                _buttonRectTransformAnimator.SetScale(_buttonRectTransformSettings._idleScale);
                _buttonRectTransformAnimator.SetAnchoredPosition3D(_buttonRectTransformSettings._idleAnchoredPosition3D);
            }

            if (!_buttonImageAnimator)
            {
                _buttonImageAnimator = GetComponentInChildren <UIImageAnimator>();
            }

            if (_buttonImageAnimator && _buttonImageSettings)
            {
                _buttonImageAnimator.SetColor(_buttonImageSettings._idleColor);
                _buttonImageAnimator.SetScale(_buttonImageSettings._idleScale);
                _buttonImageAnimator.SetAnchoredPosition3D(_buttonImageSettings._idleAnchoredPosition3D);
            }

            if (!_buttonTextAnimator)
            {
                _buttonTextAnimator = GetComponentInChildren <UITMProTextAnimator>();
            }

            if (_buttonTextAnimator && _buttonTextSettings)
            {
                _buttonTextAnimator.SetColor(_buttonTextSettings._idleColor);
                _buttonTextAnimator.SetScale(_buttonTextSettings._idleScale);
                _buttonTextAnimator.SetAnchoredPosition3D(_buttonTextSettings._idleAnchoredPosition3D);
            }

            if (!_buttonRaycastImage || !_buttonRaycastImage.raycastTarget)
            {
                List <Image> images = GetComponentsInChildren <Image>().ToList();
                try
                {
                    _buttonRaycastImage = images.First(i => i.raycastTarget);
                }
                catch (InvalidOperationException) { }
            }

            _enterDelay = Mathf.Max(_enterDelay, 0f);
            _exitDelay  = Mathf.Max(_exitDelay, 0f);
        }
Beispiel #2
0
        void OnValidate()
        {
            if (!_rectTransformAnimator)
            {
                _rectTransformAnimator = GetComponentInChildren <UIRectTransformAnimator>();
            }

            if (!_textAnimator)
            {
                _textAnimator = GetComponentInChildren <UITMProTextAnimator>();
            }

            _enterDelay = Mathf.Max(_enterDelay, 0f);
            _exitDelay  = Mathf.Max(_exitDelay, 0f);
        }