How to debug the object position in the grid of objects?

Hi All, I created 5x5 grid of objects in unity c#.
My questions is ,when I click on certain object, I want debug(print) that object position.

For Example, i click on object Grid[3,3] and i want debug(print) that object grid position.
Example “Selected : [3,3]”.
Please help me,thanks

Thank you kindly for the updated information. One way to approach this would be to use a Raycast and check whether what it hits is one of the instantiated cubes.

void Update()
{
	if(Input.GetMouseButtonDown(0)) // Left Click
	{
		// Data to be read out from the Raycast
		RaycastHit hit;
		// The ray to fire is from the camera to the mouse position
		Ray ray = Camera.main.ScreenPointToRay (Input.mousePosition);
	
		// Then, try the Raycast. If it hits something, the if statement is true
		if(Physics.Raycast(ray, out hit, 100))
		(
			// Inside, check your grid for a GameObject matching the collider of the GameObject hit.
			// Note that each cube will need a collider for this method to work, however.
			for(int x = 0; x < Width; x++)
			{
				for(int y = 0; y < Height; y++)
				{
					if(hit.gameObject == grid[x, y])
						Debug.Log("Selected: " + x + "," + y); // Or (x + 1) and (y + 1), as desired
				}
			}
		}
	}
}

With this added to your script which generated the cubes, you’ll be able to click on an object and find out which spot it was at.