[ISSUE] Assets/Subsound.js(15,12): BCE0044: expecting (, found 'var

#pragma strict

var brunoSound : AudioClip;
public var pissed;
function Update () {
if var Buddy = true; {
//DO THIS IF YELLING AT BUDDY IS TRUE
WaitForSeconds(5);

audio.PlayOneShot(brunoSound);
//SUBSOUND
var pissed = true;
}
//LET THIS REMAIN EMPTY
if var Buddy = false; {
}
}

Trying to play a sound after a certain quest is over. Gives this error:
Assets/Subsound.js(15,12): BCE0044: expecting (, found ‘var’.

if var Buddy = true; should be if (Buddy == true). Declare Buddy with var in the line above or outside the Update() method. I strongly recommend you learn basic scripting first, since the code you posted contains many other errors as well. Start here: Learn game development w/ Unity | Courses & tutorials in game design, VR, AR, & Real-time 3D | Unity Learn

1 Like