Tab between input fields

I am new to working with Unity3d, I need to navigate between several inputField, for this I have looked at the solution that is in: tab-between-input-fields, but always the FindSelectableOnUp() or FindSelectableOnDown() returns null, so my next is always null and always ends in: next = Selectable.allSelectables[0];

I did a small improvement to @virtouso answer. I start always with the first inputfield in my list and after the last inputfield I am reseting my counter to start again from beginning.

public  List<InputField> fields;
int _fieldIndexer;

private void Update()
{
if (Input.GetKeyDown(KeyCode.Tab)) {
if (fields.Count <= _fieldIndexer)
{
_fieldIndexer = 0;
}
fields[_fieldIndexer].Select();
_fieldIndexer++;
}
}

void Start () {
fields = new List<InputField>{PreNameInput, FamilyInput, BirthdateInputField};
}

• You can also change the List type to List<Selectable> to tab cycle through inputs and buttons, so users can tab to a button and hit enter to submit. – BatteryAcid May 11 at 3:39

A possible cause for the FindSelectableOnUp and FindSelectableOnDown returning null could be the value set under Navigation. Each Selectable (InputField is a Selectable) has in its inspector a section called Navigation.

This influences what FindSelectableOnDown and FindSelectableOnUp return. If vertical is not checked for any of the 2 InputFields you want to link for instance, they won't be able to navigate to each other. (Also note, the visualize button should show arrows in the scene view if Navigation is enabled for both elements)

public  List<InputField> fields;