How to update input fields via loop in script

I’m new at Unity and wants to make a Sudoku Solver.
I’ve designed the input grid using input fields in the canvas. These input fields can display the numbers I generate in my grid script which will held the solving logic. My problem is that I want to update the input fields inside the loop to display rolling numbers on the screen but can’t get it right. Currently everything is displayed after the loop is done. Any ideas?

Thank you very much for your answers, it gave me valuable insight. I’ve realised that I need to use a Coroutine.

/Dont forget to put using System.Collections.Generic; at top because “List” requires it. You also need using UnityEngine.UI; for the InputField. You do not need using System.Collections;, we are not using it and Unity will add it to the dependancey list apon build if it is in your scrip, tyhus adding more scripts to your build then you actually need. You do however, need using UnityEngine; for MonoBehaviour./

[note] notice i didn’t place in a class or namespace? you Should be able to drop this right into your script.

[Header("Settings: ")]

[Space]

[Tooltip (" Place the 'GameObject' with the Input Field component attach to it here.")]
public InputField myInputField =new InputField ();

///<summary>
/// Use this for your preset strings to display on your inputfeild
///<summary>
[Tooltip (" Use this for your preset strings to display on your inputfeild")]
public List<string>Strings=new List<string>(){
    "String 1", 
    "String 2", 
    "String 3"
}

///<summary>
/// Use this for selecting which choice you would like to display.
///<summary>
private static int selection=0;

///<summary>
/// Use this to change the current display on your InputField.
///<summary>
void Update(){
    for(int i=0;i<Strings.Count;i++){
        if(Equals(i,selection)){
            myInputField.text=String{i};
        }
    }
}

///<summary>
/// Use this to change the current selection to display via a Unity Button on an OnCallMethod.
///<summary>
public void ChangeSelection(int newSelection){
    selection=newSelection;
}

///<summary>
/// Use this to change the current selection to display via a Unity Button on an OnCallMethod.
///<summary>
public void SelectionAdd(){
    if(Equals(selection,Strings.Count)){
        return;
    }
    selection++;
}

///<summary>
/// Use this to change the current selection to display via a Unity Button on an OnCallMethod.
///<summary>
public void SelectionSubtract(){
    if(Equals(selection,0){
        return;
    }
    selection--;
}

Probobly your best bet, also look into while(ABoolValue){//Do Something} during IEnumarators to have more control.

EG.Pulled from my code My Design

 void Awake(){
    if (OnlineModeToggle) {
        if(DontLoadWithAsync){
            StartCoroutine (AwakeApplicationOnline ());
        } else{
            MainLevelManager.async = SceneManager.LoadSceneAsync (LoadingScene);
            StartCoroutine (AwakeApplicationOnline ());
        }
    }else{
        if(DontLoadWithAsync){
            StartCoroutine (AwakeApplicationOffLine ());
     } else{
           MainLevelManager.async = SceneManager.LoadSceneAsync (LoadingScene);
           StartCoroutine (AwakeApplicationOffLine ());
     }
   }
}

IEnumerator AwakeApplicationOnline (){
    if (DontLoadWithAsync) {
        //Place Data Here
        yield return new WaitForSeconds (0.2f);
        StopCoroutine (AwakeApplicationOnline ());
    } else {
        Instance.IsLoading = !MainLevelManager.async.isDone;
        while (Instance.IsLoading) {
            //Place Data Here
            yield return new WaitForSeconds (0.2f);
        
            if (Instance.IsLoading){
                yield return null;
            }
        }
        if (!Instance.IsLoading) {
            yield return new WaitForSeconds (0.2f);
           StopCoroutine (AwakeApplicationOnline ());
         }
    }
}

IEnumerator AwakeApplicationOffLine (){
    if (DontLoadWithAsync) {
        //Place Data Here
        yield return new WaitForSeconds (0.2f);
        StopCoroutine (AwakeApplicationOffLine ());
    } else {
        Instance.IsLoading = !MainLevelManager.async.isDone;
        while (Instance.IsLoading) {
            //Place Data Here
            yield return new WaitForSeconds (0.2f);
        
            if (Instance.IsLoading){
                yield return null;
            }
        }
        if (!Instance.IsLoading) {
            yield return new WaitForSeconds (0.2f);
           StopCoroutine (AwakeApplicationOffLine ());
         }
    }
}