public void SetSourceAndCenterOn(IListSource source, int index) { _source = source; _prefabSource = source as IPrefabSource; OnInvalidate(); scrollRect.content.anchoredPosition = GetCenteredScrollPosition(index); UpdateVisibilityDisjoint(); }
// Clears the list and destroy pooled elements public void Clear() { _source = null; _prefabSource = null; foreach (var pair in _activeCells) { Object.Destroy(pair.Value.View); } _activeCells.Clear(); _activeIndices = Vector2.zero; if (_poolParent != null) { Object.Destroy(_poolParent.gameObject); _poolParent = null; } _pool.Clear(); }
// Sets the data source for the virtual list public void SetSource(IListSource source) { _source = source; _prefabSource = source as IPrefabSource; Invalidate(); }