//Thoose are objects that i have;
var shooterPlatform : GameObject;
var wireFrame : GameObject;
var passObj : GameObject;
var bareels : GameObject;
//This is array List;
var randomObject;
//This is the variable of Randomly selected object; - not required
// var randomSelect;
function Awake()
{
//--------------------------------------------------------------------------
//At there, Instantiate the object that selected randomly
randomObject = new Array(shooterPlatform, wireFrame, passObj, bareels);
}
function Update () {
var randomSelect = Random.Range(0,(randomObject.length)); //since you want to get a random object every time
var position = transform.TransformPoint(Random.Range(-3.704676, 5.132769), 0, Random.Range(-3.704676, 5.132769));
//At there, Instantiate the object that selected randomly :S But it isn't worked
Instantiate(randomObject[randomSelect], position, Quaternion.identity);
}
I wrote this code for random object creation but it says “var randomSelect = Random.Range(0,(randomObject.length)); //since you want to get a random object every time”
I think there is en error Log says me : "lenght’ is not a member of ‘Object’. "
I’m really confused now.