- Home /
Code Error, help please?
My code gives the following error:
Assets/Minimap.js(8,8): UCE0001: ';' expected. Insert a semicolon at the end.
This is the code:
#pragmascript
var player = GameObject;
var blipTex = Texture2D;
function Update () {
Vector3 objPos = WorldToScreenPoint(player.transform.position);
GUI.DrawTexture(new Rect(objPos.x,objPos.y,blipTex));
}
I just don't get why it gives this error, there is a ';' at the end of line 8...
Answer by meat5000 · Sep 05, 2013 at 05:33 PM
You are writing in c# or JS?
Vector3 objPos = WorldToScreenPoint(player.transform.position); is c#
var player = GameObject; is bad JS
Dont mix languages!
Also if writing in JS
var player : GameObject; is correct, : not =
var variable : type = value;
var myNumber : float = 10.1;
Answer by bunyacloven · Nov 11, 2013 at 08:43 PM
The error occurs at (8,8), therefore your semicolon is irrelevant to the error.
Before (8,8), you have:
Vector3
In javascript, a variable is declared like:
var variableName:variableType;
Since Vector3 is a variable type, you get an error not putting a semicolon there.
Correct usage should be like:
var objPos:Vector3=WorldToScreenPoint(player.transform.position);
P.S: #pragma strict