void Start() { agent = GetComponent<NavMeshAgent>(); for (float x=0; x<200;x+=5) { for (float z = 0; z < 200; z+= 5) { GameObject go = GameObject.Instantiate(obstacle); go.transform.position = new Vector3(x, obstacle.transform.position.y, z); } } }