- Home /
unexpected token
what does it mean when it says there is an unexpected token in a script like:
unexpected token: camera
unexpected token: strict
unexpected token: implicit
can anyone help with this cos i need the script for my homework and only have a few days left to complete it. thanx
here is the script
camera: main#pragma strict
pragma implicit
pragma ;downcast;
/code>
another problem on a different script it
expecting } found ;. ( character 22)
and here is the line of code with the problem but i cant find where to put the } cos every where creates more problems with it.
public var camera; ;: main; camera;
thanx again for any help
i have managed to get these problems to go away now by having 'camera: main' ins$$anonymous$$d of main camera but it now says it wants eof ins$$anonymous$$d of camera does anyone know what that means and how to solve it?
Answer by AngryOldMan · Apr 20, 2011 at 01:29 PM
unexpected token: camera means you have the word camera in there and your not using it properly. look at the camera script reference you should spot your problem straight away.
#pragma strict
#pragma implicit
#pragma downcast
dont need to be in your script unless your optomising it for online play and they should be at the very top of the page.
an eof is an end of function which is this } character you put it at the end of functions!
//example
function Start() { DoSomething(); }
function DoSomething() { if (SomethingHasNotBeenDone) { Debug.Log ("Do Something Else"); } }
ignore the meaning of the words and look at how the eof is used, there is always a start of function and end of function just like you would use sentances and paragraphs in literary English
EDIT
if you are finding errors asking for eofs and there are already ones there it means the syntax for the previopus line is incomplete, have a look at the line above and check that the parametres you have put in match the ones on the script reference for it
this is the top of the page and camera is the first word but it is saying it needs eof. thanx for the help btw it was really helpful
i have deleted those things now cos this isnt designed for online but nod it says i need ;'s in places where there are already some there
Answer by Jesse Anders · Apr 20, 2011 at 01:13 PM
It sounds like there's a simple parsing error in your script (e.g. a mismatched brace). If you need more specific help than that, edit your post to include the script that's generating the error.
Your answer
Follow this Question
Related Questions
Converted a script from C# to JS, Unexpected Token: .. What did I do? 1 Answer
Unexpected Token }. 1 Answer
what is an unexpected token 1 Answer
Unexpected token: .. 1 Answer
Unexpected Token: Collider. 1 Answer