[Solved] Getting Navigation.selectOn___ from automatic Navigation?

Hey guys,

Does anyone know if there’s a way to extract the Selectable to be selected after a Move event from the “Automatic” Navigation type?

Motivation:
I’m extending both EventSystem and BaseInputModue for a two-player character selection screen. As such, I need to replace the standard EventSystem’s “currentSelectedObject” to keep track of multiple selections. While it seems to be working, I can’t manage to find which object will be selected after sending my moveHandler.

My (failing) code:

CharacterSelectionEventSystem eventSystem = GetComponent<CharacterSelectionEventSystem>();
ExecuteEvents.Execute(eventSystem.GetSelectedGameObject(0), axisEventData[i], ExecuteEvents.moveHandler);
Debug.Log(testBtn.navigation.selectOnRight); //prints null
GameObject rightSelectable = eventSystem.GetSelectedGameObject(0).GetComponent<Button>().navigation.selectOnRight.gameObject; //selectable
eventSystem.SetSelectedGameObject(0, rightSelectable);

Thanks in advance as always,
Patrick

1 Like

Selectable has the public functions:

FindSelectableOnUp
FindSelectableOnDown
FindSelectableOnLeft
FindSelectableOnRight

You should be able to use this to find out what will be selected :slight_smile:

3 Likes

…Well now I just feel dumb. Thanks a bunch!

2 Likes

7 years later, I end here and feel dumb as well

2 Likes

but is there anyway to tell it what to use without using explicit?