void ChangeSelection(int _directionSign) { selectable = false; switch (Mathf.Sign(_directionSign)) { case -1: if (currentlySelectedButtonIndex == customButtons.Length - 1) { currentlySelectedButtonIndex = 0; } else { currentlySelectedButtonIndex++; } break; case 1: if (currentlySelectedButtonIndex == 0) { currentlySelectedButtonIndex = customButtons.Length - 1; } else { currentlySelectedButtonIndex--; } break; } currentlySelectedButton?.Deselect(); currentlySelectedButton = customButtons[currentlySelectedButtonIndex]; currentlySelectedButton.Select(); }
public void SelectFirst() { DeselectAll(); currentlySelectedButtonIndex = 0; currentlySelectedButton = customButtons[currentlySelectedButtonIndex]; currentlySelectedButton.Select(); }
public void Setup() { customButtons = GetComponentsInChildren <ButtonUI>(); foreach (ButtonUI button in customButtons) { button.Setup(); } if (autoSelectFirstOne) { currentlySelectedButton = customButtons[0]; currentlySelectedButton.Select(); } if (fadeOutOnSetup) { FadeButtons(false, 0); } enabled = !disableOnSetup; }