Created
May 14, 2019 17:30
-
-
Save tklee1975/8711f8ca8b5e1483d52dab6e486d919a to your computer and use it in GitHub Desktop.
Unity UI Selectable Navigation Code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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