- Home /
expecting EOF, found 'else'.
Hi i'm making a main menu and came over this Error: (expecting EOF, found 'else'.) at line (19,9) it doesnt make sense to me but heres the script:
var IsQuitButton = false;
function OnMouseEnter()
{
renderer.material.color = Color.red;
}
function OnMouseExit()
{
renderer.material.color = Color.white;
}
function OnMouseUp()
{
if ( IsQuitButton )
//Quit the game
Application.Quit();
}
else
{
//play the game
Application.LoadLevel(1);
}
}
Comment
DERP.
EOF is End of File. $$anonymous$$eans you forgot an open or close bracket. In this case, an open bracket on line 15.
Best Answer
Answer by Yokimato · Apr 10, 2013 at 02:32 AM
You're missing an open curly bracket:
if ( IsQuitButton ) // <--- need a '{' here
//Quit the game
Application.Quit();
}
Specifically to your error message, EOF stands for End Of File. Meaning that the parser found your end curly with out the open which closed the class and the parser doesn't except anymore code after that...but yours obviously does with the 'else'. Hope that makes sense.