I wrote the following code to instantiate the PathFloorUnit Prefab (meant to form path in my running game) and reference it to the Path array.This code instead only forms one instance.So, why is it not working and how do we correct it?
using UnityEngine;
using System.Collections;
public class CreateNew : MonoBehaviour {
//to get reference from original prefab
public Object PathFloorUnit;
//gameObject array created to get reference to instances of instantiated prefab
GameObject[] Path;
void Start () {
//To create instance of PathFloorUnit and assign reference to Path GameObject arrray
for(int x=0;x<=6;x++){
Path[x]=Instantiate(PathFloorUnit,newVector3(0,0,10*x),Quaternion.identity) as GameObject;
}
}
}