Hi, I am creating empty game object in a grid, however the code below causes two game objects to spawn
The “Non cloned” instance of each game object doesn’t even have the correct x/z positions they are all set at 0, 0, 0
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class TerainGen : MonoBehaviour
{
public Plane terrainChunk;
public float width = 1f;
public float height = 1f;
public int MapSize = 10;
public int x, z;
public Material grass;
public GameObject Astar;
Grid grid;
void Start()
{
createChunks();
}
public void createChunks() {
for (int x = 0; x < MapSize; x++)
{
for (int z = 0; z < MapSize; z++)
{
Debug.Log("Chunk x" + x + " z " + z);
Instantiate(new GameObject("Chunk x" + x + " z " + z), new Vector3(x * 25, 0, z * 25), Quaternion.identity);
}
}
}
}