Tracking ojects grid positon

So Recently I have been trying to figure out how I would go about putting together a rudimentary puzzle game system inside of Unity. Something based in blocks of a static size and shape. What I arrived at was that I should create a 2D gird using a 2D array that could then store the positions of all of the various puzzle objects in the grid. That would be easy to loop through and check for matches and etc. My biggest question is really how I would go about tracking the position of the puzzle objects inside that array!

I was also wondering about the “best” way to go about establishing that 2 dimensional grid. This question is sort of broad. Please ask away in the comments if you need me to expand on anything here. Thanks a lot for the help!

hmmm. What i would do is scale the ‘grid’ based on real world positions.

Like if a 1 unit cube is at 0,0 in your game, the real coordinates would be at

Vector3(0.5f,0.5f, 0)

That way, all you need to do is pass the coordinates through a function to extract the game coordinates from the real word position

void GetPos(GameObject tempGO){
     Vector3 gameLoc;
     gameLoc = new Vector3(tempGO.position.x - 0.5f, tempGO.position.y - 0.5f, 0);
     //Assign gameLoc to a public variable to use. 

}