- Home /
Where is the missing semicolon?
I just need to get the objects with the "Gravity" tag. Here is the error: Assets/Scripts/PlanetGravity.js(11,24): UCE0001: ';' expected. Insert a semicolon at the end.
Here is the line: var gravObjects[] = GameObject.FindGameObjectsWithTag ("Gravity"); I have it at the end. Where else would I need a semicolon?
I'm not a Javascript programmer so I don't know if Rutter's solution is correct but here's a tip: If the error message seems wrong, it might be. Have a look a just before and just after the line that is apparently wrong. You might find errors with them, ins$$anonymous$$d.
Answer by rutter · Jan 23, 2014 at 10:27 PM
Not quite valid syntax:
var gravObjects[] = ...
Types in UnityScript look more like this:
var gravObjects : GameObject[] = ...
Either of the following should work, if there are no errors elsewhere in the script:
var gravObjects = GameObject.FindGameObjectsWithTag ("Gravity"); #duck typing
var gravObjects : GameObject[] = GameObject.FindGameObjectsWithTag ("Gravity");
Your answer
Follow this Question
Related Questions
Need to use 2 different language scripts. 1 Answer
Static Variable Problem 1 Answer
Access a JavaScript variable from a C# script? 2 Answers
Change GUI Value with Variable 1 Answer