Unexprcted Token Error.

This is the code below the error is:

Assets/placePickups.js(8,18): BCE0043: Unexpected token: 2.

#pragma strict
var objectToCreate : Transform;
var radius : int;


function Start () {

    for (var 1 : int = 0;1 < 5; 1++)
    {
        var randWithinCircle = Random.insideUnitSphere * radius;
        var pickUp = Instantiate (objectToCreate, Vector3(936 + randWithingCircle.x, 8, 1080 + radWithinCircle.z), Quaternion.identity) as GameObject;
    }
}

That looks suspiciously like a number 1 after the var keyword. You can’t use numbers as variable names. Use a letter instead (most people choose i), I’ll use the letter x, just so it’s easy to differentiate on the web page:

for (var x : int = 0;x < 5; x++)
1 Like