I am not new to scripting, but I am new to Unity’s scripting, and i have to say that it seems kind of picky.
So i have looked around and i get the code structure but i still feel lost. I have a prefab, and i have attached this Javascript to it:
var Ball : Rigidbody;
var MaxBalls = 20;
var spawnWait = 1;
var NumOfBalls = 0;
function Start () {
InvokeRepeating("spawnBall", 2, spawnWait);
}
function spawnBall () {
while (NumOfBalls < MaxBalls+1)
{
NumOfBalls++;
var clone : Ball;
clone = Instantiate(Ball, transform.position, transform.rotation);
}
}
I keep getting this error: The name ‘Ball’ does not denote a valid type (‘not found’).
Please help?