InfiniteScroll API

There are a few more properties and methods that are only accessible programmatically:

  • DataSource: IEnumerable property that will load a collection into the InfiniteScroll object.

  • SelectedIndex: You can get the index of the selected item. If you set this property the selected item will change accordingly.

  • SelectedItem: You can get the selected item or set it, changing the UI accordingly.

  • SelectedPrefab: You can get the selected prefab or set it, changing the UI accordingly.

  • ScrollVelocity: You can get the velocity of the scroll movement.

  • ScrollVelocitySign: You can get the sign of the scroll movement’s velocity.

  • OriginalScrollVelocity: You can get the original velocity of the inner ScrollRect. ScrollVelocity is calculated by InfiniteScroll algorithm and may not be the same velocity as the OriginalScrollVelocity.

  • Next: This method will move the collection forward. It’s overloaded so you can pass a uint as a parameter and move the collection some steps forward.

  • Previous: This method will move the collection backward. It’s overloaded so you can pass a uint as a parameter and move the collection some steps back.

  • Move: This method will move the collection. It accepts an integer as a parameter. If you pass a negative value it will have the same effect as calling Previous. This method is very useful if you need to have +1 steps and want to control the movement by Editor handlers as Previous and Next are not available there in its overloaded form (because of the uint parameter).