public void ScrollToShowItem(LogHistoryItem item) { int index = _LogHistory.GetIndexByItem(item); int itemTop = GetItemTop(index); int CurItemHeight = itemTop + GetItemHeight(index); //float scrollTopPos = _scrollPosition.y; float scrollBottomPos = _scrollPosition.y + _listHeight; if (CurItemHeight > scrollBottomPos) { _scrollPosition.y = Mathf.Min( Mathf.Clamp((float)itemTop, 0f, float.PositiveInfinity), Mathf.Clamp(CurItemHeight - _listHeight, 0f, float.PositiveInfinity) ); } }