Scroll Rect item selection one by one with arrow keys.

Hi there,

I’m trying to accomplish something like this:


182109-example.png


The idea is to have a list of objects in a Scroll Rect and whenever the player clicks on an arrow key (up or down) change the element from the list, plus the description next to it.
I know it’s a lot to ask, but maybe someone has an implementation or tutorial on something like this.

I’ve been searching but i didn’t find anything alike. Any reference/sugestion is welcomed.

Thanks in advance.

You don’t have to be dependent on the Scrollrect of every scrollable UI, for some cases you can create your own component similar to scrollrect.

Instead, you can create your own script to implement your custom scroller. I have done such kind of thing before so to do that below are the steps:-

  1. Create a Custom ScrollRect script of your own.
  2. Take reference to the list container and list item prefab in the script.
  3. Expand the size of container item, use the formula, (Item height * number of items) + (vertical space* (number of items -1))
  4. Place the list item in the list container with respect to Item height, vertical spacing, and item index.
  5. Once done with all the above steps you are almost done. Now just create a method in your Custom ScrollRect to manipulate the Y-axis of the list container.

UPDATE: I found a Unity Package that suits what i want to do, it’s called Simple Scroll-Snap. I still need to add the arrow key control, but i think that won’t be a problem.
SimpleScroll-Snap