Basically I used “Instantiate” to generate some cubes in my scene. When I check their position via script with “GameObject.Find” it says something like “0,0,0; 3,0,0, 6,0,0” etc. When I check the position via “Inspector” its totally different. I see values like -51.23525,2.34234,30.23423 ( you got the point ).

Why does this happen and how can I fix it?

I want to create a script that moves a sphere based on the coordinates of my generated cubes. Something like: Go from cube (0,0,0) to cube (3,0,0) but which position do I use? Can I change the position from “Inspector” to be the same as the position I set from code? If i spawn my object at (0,0,0) where my first cube is spawned, their position doesn’t match…

Here is my function that generates a “floor” made of cubes based on a matrix of 1 and 0:

```
void CreateFloor(int i, int j,int floor)
{
float size = FloorTile.transform.localScale.x;
if (floor == 1)
{
GameObject FloorObject = Instantiate(FloorTile, new Vector3(i * size, 0, j * size), Quaternion.identity);
FloorObject.name = "Tile[" + i + "][" + j + "]";
FloorObject.transform.SetParent(Floor.transform);
}
if(floor==0)
{
GameObject FloorObjectPath = Instantiate(FloorTile, new Vector3(i * size, 0, j * size), Quaternion.identity);
//Debug.Log(i+" "+j);
FloorObjectPath.name = "TilePath[" + i + "][" + j + "]";
FloorObjectPath.transform.SetParent(Floor.transform);
}
```