Why am i getting this error?!

Assets/Scripts/breathingSystem.js(17,1): BCE0044: expecting EOF, found ‘else’.

var movingSound : AudioClip;
var idleSound : AudioClip;
var isMoving : boolean = false;
var isIdle : boolean = true;

function Start ()
{
if(Input.GetKeyDown("Vertical") || Input.GetKeyDown("Horizontal"))

	isIdle = false;
	isMoving = true;
	audio.clip(movingSound);
	audio.Play();


}
else if(Input.GetKeyUp("Vertical") || Input.GetKeyUp("Horizontal"))
{

	isIdle = true;
	isMoving = false;
	audio.clip(idleSound);
	audio.Play();

}

These are all duplicate questions : * http://answers.unity3d.com/questions/428154/why-am-i-getting-this-error-2.html * http://answers.unity3d.com/questions/428203/if-var-true-do-something-not-being-detected.html * http://answers.unity3d.com/questions/428237/audio-says-it-is-playing-in-audiosource-but-is-not.html @inglipX : Do Not Post Duplicate Questions Watch : http://video.unity3d.com/video/7720450/tutorials-using-unity-answers

2 Answers

2

at the end of line 8 should be a {

And you also miss one { at the end of your file to close the Update() function

huh? there is no { at line 17

heres the layout of a javascript:

var Thing : Transform;

function Update() 
{
    if(Thing.name == "Thing")
    {
        Destory();
    }
    else
    {
        Destroy(Thing.gameObject);
    }
}

if you follow the structure it can help you