Scroll to index?


Is it possible to by js code trigger a scrollview to scroll to a specified index?


Yes you can! There are two ways in which you can get a “scroll to…” behaviour using the Scroll View node: Scroll To Position, and, Scroll To Index. You find them in the bottom in the Scroll View property panel.

Both are triggered by taking a boolean or a signal as a input into the Scroll View and connect that input the the property

Without building a too advanced example, I would probably go for something like this:

The two buttons in the top change the state node to either ‘bottom’ or ‘top’ state. When the state has changed completely (‘Has reached bottom/top’) it triggers ‘Do’ in the Scroll View ‘Scroll To Index’. Note that I’ve hardcoded the Top ‘position’ value to zero, and take the ‘Child Count’ value from the Scroll View as the Bottom ‘position’ value.

Hope that made sense, and good luck!