GameObject[] cube;
public GameObject tank;
public GameObject jeep;
void Start()
{
cube = new GameObject[2000];
for (int i = 0; i < cube.Length / 2; i++)
{
cube[i] = (GameObject)Instantiate(tank);
}
for (int i = cube.Length / 2; i < cube.Length; i++)
{
cube[i] = (GameObject)Instantiate(jeep);
}
}
void Update()
{
if (Input.GetKeyDown(KeyCode.Space))
{
for (int i = 0; i < cube.Length; i++)
{
Destroy(cube[i]);
cube[i] = (GameObject)Instantiate(jeep);
}
}
for (int i = 0; i < cube.Length; i++)
{
cube[i].transform.position = new Vector3(10, 10, 10);
}
}