Hi guys. I’m a stuck on updating the game UI button in the Hierarchy but on the Inspector it’s already been shuffled
Image link if ever the image on the spoiler is pixalted
Image

As seen on the Image on the Inspector I was able to shuffle the buttons but I’m having problem in updating the buttons on the Hierarchy.
I’ve tried lots of ways and search the google. I can’t to make it work;
Tried using this and iterate from it. And other links that I can’t find or remember the title anymore.
Here’s the code I use to create the button in Awake()
void CreateAllButtons()
{
for(int i = 0; i < numberOfButtonsToCreate; i++)
{
Button buttonInstance = Instantiate(buttonPrefab);
buttonInstance.gameObject.name = "" + i.ToString();
buttonInstance.GetComponentInChildren<Text>().text = i.ToString();
buttonInstance.gameObject.transform.SetParent(buttonHolderPanel, false);
numberButtons.Add(buttonInstance);
}
ShuffleButtons(numberButtons);
}
void ShuffleButtons(List<Button> buttonToShuffle)
{
List<Button> tempNumberButtons = new List<Button>(buttonToShuffle);
for(int i = 0; i < buttonToShuffle.Count; i++)
{
int randomIndex = Random.Range(0, tempNumberButtons.Count);
buttonToShuffle[i] = tempNumberButtons[randomIndex];
tempNumberButtons.RemoveAt(randomIndex);
}
}
Thanks.