- Home /
Question by
alcohollica · May 01, 2014 at 11:35 AM ·
javascripterror
expecting EOF, found '}'.
I have a code like that,
var speed : float = 5.0f;
var X : float;
function Start () {
X = transform.localScale.x;
}
function Update () {
if(Input.GetKey("W"){
transform.position.y += speed * Time.deltaTime;
}
if(Input.GetKey("A"){
transform.position.x -= speed * Time.deltaTime;
transform.localScale.x = X;
}
if(Input.GetKey("D"){
transform.position.x += speed * Time.deltaTime;
transform.localScale.x = -X;
}
}
When I start the game, I get
Assets/Move.js(9,29): BCE0044: expecting ), found '{'. Assets/Move.js(13,29): BCE0044: expecting ), found '{'. Assets/Move.js(16,9): BCE0044: expecting EOF, found '}'. Errors, How I can fix it?
Comment
Best Answer
Answer by KevLoughrey · May 01, 2014 at 11:41 AM
The brackets in your if statements aren't balanced. They should be:
if(Input.GetKey("W"))
if(Input.GetKey("A"))
if(Input.GetKey("D"))
Your answer
Follow this Question
Related Questions
Script Errors Not Sure Why 0 Answers
Animation Script Error 1 Answer
Scripting error #2! 2 Answers
problem at adding script 1 Answer