// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.L)) { if (m_LoopScrollRect is LoopVerticalScrollRect) { Number = (int)(ItemIndex / m_LoopScrollRect.m_ContentConstraintCount); pos = new Vector2(0, Number * m_LoopScrollRect.GetItemSize()); m_LoopScrollRect.SetContentAnchoredPosition(pos); } if (m_LoopScrollRect is LoopHorizontalScrollRect) { Number = (int)(ItemIndex / m_LoopScrollRect.m_ContentConstraintCount); pos = new Vector2(Number * m_LoopScrollRect.GetItemSize(), 0); m_LoopScrollRect.SetContentAnchoredPosition(pos); } } }