Пример #1
0
        public void ScrollToPosition(float flatPos)
        {
            Init();
            if (ScrollRect != null)
            {
                ScrollRect.StopMovement();
                Vector2 v = CacheRectTransform.anchoredPosition;
                if (IsVertical)
                {
                    v.y = UGUITools.ClampScrollPos(flatPos, CacheRectTransform, ScrollRect) * -DirSign;
                }
                else
                {
                    v.x = UGUITools.ClampScrollPos(flatPos, CacheRectTransform, ScrollRect) * DirSign;
                }

                CacheRectTransform.anchoredPosition = v;
            }
        }