- Home /
error message for var
I am getting a very weird error message. all I need to have on a script is
var
function Update() { }
And I get an error message that says "Unexpected token: var" or "expecting EOF found: var"
I've tried opening a new project and that didn't work. I even uninstalled Unity and reinstalled it. Am I just stupidly making a mistake, or is there something wrong with my unity program??
Answer by Fanboy · Jul 18, 2010 at 04:19 PM
"var" declares a variable, you need a name after it.
Just delete the word "var", and your script will compile.
But what are you trying to do?
Right now I'm just trying to learn how to use unity ($$anonymous$$ainly scripting) and it seams like as soon as I figure one thing out a million other difficulties pop up, I guess that's just how it goes though. Thanks for the answer, I thought my computer was wigging out or something but I guess I just need to understand how to use var a little better :P
var variableName : VariableType = value; ... eg: var str : String = "Test"; The variable type and value parts are optional, but if you don't assign a value, you should assign a type
Your answer
Follow this Question
Related Questions
3 java errors on a basic shooting script? 2 Answers
Formatting problems in Script 2 Answers
SwipeControl package error in unity iPhone 1.7 1 Answer
scripting problem with if statements 1 Answer
Problem with "Pick up key" script 2 Answers