I am making a board game. There is a grid. Grid has many tiles. Board image. Tiles are child game objects of grid. I want to reorder tiles randomly at the end of each level.
foreach (GameObject tile in tileList)
{
tile.transform.SetSiblingIndex(UnityEngine.Random.Range(0, tileCount));
}
I tried like this. Is this snippet of code correct?
All items are UI element. They aren't sprite. Grid has grid layout group component. Positions of tiles are automatically assigned by grid.