- Home /
Script errors. I'm Confused
Okay i am confused alot i can't see what i do wrong i tried everything make a new js file and new project also re-install unity but i still get the error
"Assets/Scripts/CombatSystem.js(1,14): UCE0001: ';' expected. Insert a semicolon at the end." "Assets/Scripts/CombatSystem.js(2,14): UCE0001: ';' expected. Insert a semicolon at the end."
I am very confused because i already put a semicolon at the end, and! when i delete the 2 semicolons then i get 2 more errors that says the same as the above errors :P i am pretty much confused. Please help :-)
var minAttack 10;
var maxAttack 20;
function Start () {
}
function Update () {
}
function combatSystem() {
var damage = Random.Range(minAttack, maxAttack);
}
The way you declare your variables is incorrect
automatically typecast :
var $$anonymous$$Attack = 10;
var maxAttack = 20;
typecast and assign :
var $$anonymous$$Attack : int = 10;
var maxAttack : int = 20;
if they are floats, even more reason to typecast then assign
var $$anonymous$$Attack : float = 10;
var maxAttack : float = 20;
simultaneous post !
Ah thanks yes of course i see i needed a = but why did the editor Then say i needed a semicolon and not a = ?
It was also confused ?! That was a joke ....
It would have seen
var $$anonymous$$Attack 10;
so it read var (ok I am declaring a variable), $$anonymous$$Attack (so the name of the variable is $$anonymous$$Attack), 10 (what? I was expecting : or = , I guess that line finishes at $$anonymous$$Attack, therefore I need a ; ). That's roughly why you got that error =]
No it wasn't confused that you explained i understand that you wrote
Answer by fafase · Jan 27, 2013 at 08:11 AM
Try to change this
var minAttack 10;
var maxAttack 20;
for
var minAttack = 10;
var maxAttack = 20;
Your answer
Follow this Question
Related Questions
dont work maxdistance 0 Answers
Camera's wont change 2 Answers
Error in script I haven't even opened 0 Answers
Crash on .exe but fine on editor... 1 Answer
A node in a childnode? 1 Answer