Reference GameObjects from an Array

I am creating a small tile game and I thought it would be fun to instantiate the tiles and store a reference to them in an array on start, but I am having a little trouble. I have tried looking this up, but I am really struggling to search for reinvent information.

In the below code I create an array, instantiate a tile, rename it so it matches the grid address I want to use and then I have tried to put it into the array. But the print functions all return 3-3, so it appears that I have added a reference to my Tile GameObject in my script rather than each array address referencing a different tile. I do intend to pass this array to another function once fixed, but how do I fix this?

public class InstantiateGrid : MonoBehaviour {

    public GameObject Tile;

    void Start () {
    
    GameObject[,] tileArray = new GameObject[3,3];
    
    for (int i = 1; i < 4; i++) {
        for (int j = 1; j < 4; j++) {
            Object.Instantiate(Tile);
            Tile.name = i + "-" + j;
            tileArray[i,j] = Tile;
        }
    }

    print (tileArray[1,1]);
    print (tileArray[1,2]);
    print (tileArray[1,3]);
    }
}

‘Tile’ is a reference to the prefab object, not the newly instantiated copy. All you’re doing is renaming the prefab and adding a reference of the prefab to the array. You need a temp variable to store the instantiated reference to. Also, you’re not assigning anything to the first slots of the array. All list/array style variables in coding start at 0. The provided code also gives an IndexOutOfRangeException error when trying to assign to slot 3 as the array goes from 0 to 2.

using UnityEngine;
using System.Collections;

public class InstantiateGrid : MonoBehaviour
{
    GameObject[,] tileArray = new GameObject[3,3];
	public GameObject TilePrefab;
	
	void Start () {
		GameObject tileInstance;

		for (int i = 1; i < 4; i++) {
			for (int j = 1; j < 4; j++) {
				tileInstance = Instantiate(TilePrefab) as GameObject;
				tileInstance.name = i + "-" + j;
				tileArray[i-1, j-1] = tileInstance;
			}
		}

		print (tileArray[0,0]);
		print (tileArray[0,1]);
		print (tileArray[0,2]);
	}
}