- Home /
When building a script, says semicolon is missing.
I wrote this script:
var moveSpeed - 1.0; var turnSpeed - 1.0;
function Update() { /
if(Input.GetButtonDown("Jump")) { transform.position.z += 1.0; } /
if(Input.GetButton("W"))
{
transform.position += transform.foward * moveSpeed * Time.deltaTime;
}
if(Input.GetButton("S"))
{
transform.position += -transform.foward * moveSpeed * Time.deltaTime;
}
if(Input.GetButton("A"))
{
transform.eulerAngles.y += -turnSpeed * Time.deltaTime;
}
if(Input.GetButton("D"))
{
transform.eulerAngles.y += turnSpeed * Time.deltaTime;
}
}
And when I try to build it, it gives me errors for the top two lines saying that I'm missing semicolons. What do I do?
That's not an appropriate use of GetButton. Use Get$$anonymous$$ey if you're hard-coding specific keys; GetButton is used for descriptive names that can be assigned arbitrary input in the startup dialog. Like "Fire", which could be left-click/space/whatever. Although in this case GetAxis would be simpler anyway.
Your answer
Follow this Question
Related Questions
Pickuptype script keeps ringing Compiler errors 2 Answers
Compiler errors need help with. Please 1 Answer
Compiler error issue(not what you think!) 1 Answer
Why compiler errors on a script that's not used in the scene? 1 Answer
all compiler errors have to be fixed before you can enter play mode 0 Answers