I'm new to 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(update all input fields to new value if there are one) when a value changes but can't get it right. Currently everything is displayed after the loop is done(in the next frame), but I need the values to update while the loop is running. Any ideas?
using System.Collections;
using System;
using System.Collections.Generic;
using System.Threading;
using UnityEngine;
using UnityEngine.UI;
using System.Diagnostics;
using Debug = UnityEngine.Debug;
public class SudokuGrid : MonoBehaviour
{
public InputField v00, v01,v02, v03, v04, v05, v06, v07, v08;
private int[,] arr = new int[9, 9];
public void Upd()
{
v00.text = arr[0, 0].ToString();
v01.text = arr[0, 1].ToString();
v02.text = arr[0, 2].ToString();
v03.text = arr[0, 3].ToString();
v04.text = arr[0, 4].ToString();
v05.text = arr[0, 5].ToString();
v06.text = arr[0, 6].ToString();
v07.text = arr[0, 7].ToString();
v08.text = arr[0, 8].ToString();
}
void Start()
{
}
void Update()
{
int c = 1;
for (var a = 0; a < 9; a++)
{
for (var b = 0; b < 9; b++)
{
arr[a, b] = c;
c++;
Upd();
//need to update all the inputfields here to display on screen
}
}
}
}