- Home /
Unexpected Token Error
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;
}
}
yes these are scripts that I was given to use as a handout from my lecturer. ik they are correct and they work so i have made a mistake somewhere but can seem to work it out. since this the only program$$anonymous$$g I done.
Answer by MrSoad · Dec 15, 2014 at 03:44 AM
Are these ** actually in your script, they should not be there. Or are you trying to use these to highlight the problem?
Did you mean :
for (var i : int = 0; i < 5; i++)
not :
for (var 1 : int = 0;1 < 5; 1++)
Lastly you never give the radius var a value just a type(int). This var needs a value. It's type would also be better as float not int.
you feel like such an idiot when it staring you in the face......
yh i had the letter i as a numeric 1.
sorry...
No problem, I edited my answer above with a bit more info that should also be of use :)
thanks for all the help.
i got to hand this game in to him in like 5 hrs :P so tht just the last script :P
Cool, good luck! Don't forget to accept an answer when your question is answered :D
Your answer
Follow this Question
Related Questions
Unxepected token: Var (Please Help) 1 Answer
Var Error Help 1 Answer
Expecting eof found } 1 Answer