- Home /
The question is answered, right answer was accepted
!!!BCE0044: expecting EOF, found 'else'.!!!!!!
// im getting this error in the title with the else part what did i do wrong i try respecting the bracket like others script but this one doesn't seem to like it.
var animator : Animator;
function Start () {
animator = GetComponent( Animator );
}
function Update () {
if (Input.GetMouseButtonDown (0))
{
shootAnimation ();
}
}
function shootAnimation ()
{
animator.SetBool( "shoot" , true);
}
else // this part
{
if (Input.GetMouseButtonUp (0))
{
animator.SetBool ( "shoot", false);
}
}
// im using the animator of unity mechanic and im trying to tell that if the player stop touching the mousebutton it will become false.(back to idle).
Answer by YoungDeveloper · Dec 15, 2013 at 03:05 AM
Before else, there should be if, or else if statement, you don't have neither.
Also, that else, and if are not in any function.
function Start (){
animator = GetComponent( Animator );
}
function Update(){
if (Input.GetMouseButtonDown (0)){
shootAnimation ();
}
}
function shootAnimation(){
animator.SetBool( "shoot" , true);
if (Input.GetMouseButtonUp(0)){
animator.SetBool ( "shoot", false);
}
else{
//your else
}
}
You have of course spotted the error, but your solution has a little logical error. shootAnimation is called once when you press the button down, so it makes no sense to check for button up in there. I'm pretty sure he actually wants both if-statements in Update.
Yeah, i saw what you mean, but i can't predict 100% what he wanted. Plus, let's leave something for himself shall we :-)
Follow this Question
Related Questions
expecting EOF, found 'else'. 1 Answer
Error BCE0044 plz help 0 Answers
C# error - A namespace can only types and namespace declarations 2 Answers
Set All bool parameters in animator to false 1 Answer
Animations not Transitioning 0 Answers