I'm trying to spawn spheres that are randomly separated and have random sizes. Right now my script just spawns one sphere and I get this error
"InvalidCastException: Cannot cast from source type to destination type. Particle Script.Start () (at Assets/Particle Script.js:10)"
Here is my script
var numberofpartices= 10;
var particles=transform;
var seperation= Random.Range (-10,10);
var particlemaxsize=5;
function Start () {
for (var i : int = 0;i < numberofpartices; i++) {
var numRandom: int = (Random.Range(0,10)+.5);
var particleMade: GameObject = Instantiate (particles, Vector3(i*seperation, 0, i*seperation), Quaternion.identity);
particleMade.transform.localScale= Vector3.one *numRandom;
}
}
how do I get it to spawn randomly sized and randomly spaced spheres? thanks for the help!