Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save tklee1975/8711f8ca8b5e1483d52dab6e486d919a to your computer and use it in GitHub Desktop.

Select an option

Save tklee1975/8711f8ca8b5e1483d52dab6e486d919a to your computer and use it in GitHub Desktop.
Unity UI Selectable Navigation Code
public Button[] buttonArray;
public Selectable currentSelectable;
public void nextButton() {
if(currentSelectable == null) {
currentSelectable = buttonArray[0];
currentSelectable.Select();
return;
}
currentSelectable = currentSelectable.FindSelectableOnDown();
currentSelectable.Select();
}
public void lastButton() {
if(currentSelectable == null) {
currentSelectable = buttonArray[0];
currentSelectable.Select();
return;
}
currentSelectable = currentSelectable.FindSelectableOnUp();
currentSelectable.Select();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment