- Home /
Expecting EOF found else??
i did find the same problem except it wasnt the exact same as mine...please help me function Update () { if(Input.GetButtonDown("Vertical")) walking = true; walkAnimation.Play(); } else { if(Input.GetButtonUp("Vertical")) walking = false; walkAnimation.Stop(); }
Answer by Bunny83 · Sep 09, 2013 at 11:19 PM
Just by reading your title i can say that you have more closing brackets than opening brackets. Such errors can easily avoided when you use a proper indention style.
You don't have an opening bracket after your if statement but you have a closing which doesn't close the if but the Update function. That means your else keyword is outside the Update function.
sigh
function Update ()
{
if(Input.GetButtonDown("Vertical"))
{
walking = true;
walkAnimation.Play();
}
else
{
if(Input.GetButtonUp("Vertical"))
{
walking = false;
walkAnimation.Stop();
}
}
}
but i also want an idle animation to play while im not moving or hlding any buttons down
Your answer
Follow this Question
Related Questions
How do I make my script switch back to my regular animations 1 Answer
Camera Move 1 Answer
Reversing Door Animation 1 Answer
Multiple Animations for the Same GameObject 2 Answers
Mecanim not updating script when it switches state? 2 Answers