public void CreateDebugObjects(Transform debugPrefab)
{
for(int x = 0; x < width; x++)
{
for(int z = 0; z < height; z++)
{
GridPosition gridPosition = new GridPosition(x, z);
Transform debugTransform = GameObject.Instantiate(debugPrefab, GetWorldPosition(gridPosition), Quaternion.identity);
GridDebugObject gridDebugObject = debugTransform.transform.GetComponent<GridDebugObject>();
Debug.Log("x: " + x + "; z:" + z);
Debug.Log(GetGridObject(gridPosition));
gridDebugObject.SetGridObject(GetGridObject(gridPosition));
}
}
}
This Debug.Log(GetGridObject(gridPosition));
returns x=0, z=0