Automatically select next InputField on Android

In order to make the next InputField be selected once you finish with one field, I have this method called OnEndEdit for each InputField in the scene. fields is an array of all the InputFields in order, index is the index of the InputField that called OnEndEdit.

public void NextField(int index) //Selects the next input field once you leave one
{
   if (index < fields.Length - 1)
   {
       if (!fields[index + 1].transform.parent.Equals(fields[index].transform.parent)) //if the current selected field and the next field have different parents, they're on different pages
       {
           NextPage();
       }

       fields[index + 1].Select();
   }
}

In the editor this works fine, but this is for an Android app and on Android, sometimes it gets into some sort of loop and you just see it rapidly jumping through each InputField until it reaches the end.

This happens regardless of whether the input text is empty or not. I’ve tried using EventSystem.SetSelectedGameObject instead of InputField.Select. I tried adding a check to see if the input text is empty before doing anything. Someone even suggested that I try to add the listener when an InputField is selected and remove it after the listener is called but that also didn’t work. This is driving me crazy. It sounds like such a basic thing but I cannot get it to work. There’s no way nobody tried to do this before me.

Help please!

Hello,

I have exactly the same problem, and can’t find any other topic with a solution. Did you find the origin of it ?

Thanks

Hi
Maybe u can try using the unity event On End Edit (string) function which is on inputfield

Example in a script

EventSystem eventSystem; ( refer to the event system game object)

//add this public void function to On End Edit event fucntion on InputField
public void XXXX()
{
eventSystem.SetSelectedGameObject([your target game object]);
}