- Home /
UCE0001: ';' expected. There is one there?
I have got this error with my script at the moment. The entire console log is as follows:
Assets/Scripts/In-Game/TapMenu Render.js(10,22): UCE0001: ';' expected. Insert a semicolon at the end.
Usually when I have these messages, it's from a simple mistake and easily fixable, but I don't get this one, here is my code:
#pragma strict
var TapMenu : GameObject;
function Start () {
TapMenu.transform.position.y = 100000;
}
function Update () {
for (var i = 0; i < Input.touchCount; ++i) {
Touch touch = Input.GetTouch(i);
if (touch.phase == TouchPhase.Began) {
TapMenu.transform.position = touch.position;
}
}
}
I believe it is referencing to the following line:
Touch touch = Input.GetTouch(i);
But I have made sure that there is a semicolon there on numerous occasions. I have tried exiting Unity and even after updating to 4.6.x I've no luck. Any help with this will be greatly appreciated.
Answer by tanoshimi · Dec 06, 2014 at 04:55 PM
You're mixing C# and Unity script syntax. That line should be:
var touch : Touch = Input.GetTouch(i);
Yeah I was just answering the exact same thing. This is definitely correct. (Though we could argue that the compiler gives a rather weird error.)
Ah, thank you for clearing it up. I took the touch part from an answer I saw a while back clai$$anonymous$$g to be in JS, looks like it wasn't fully. Thank you for your answer! :)