- Home /
Question by
Gaming Worlds · Jan 10, 2016 at 04:00 AM ·
scripting problembuttonsound
Problem with stopping audio?
So I get the error Only assignment, call, increment, decrement, and new object expressions can be used as a statement
in this code
public void sound (string sound)
{
if (GetComponent<AudioSource> ().isPlaying) {
GetComponent<AudioSource> ().Stop;
} else {
GetComponent<AudioSource> ().Play;
}
}
I want to alternate between stopping and playing the song when a button is pressed. I know this is probably wrong, so how can I do it right?
Comment
Best Answer
Answer by Gaming Worlds · Jan 10, 2016 at 04:05 AM
woops just missing the () at the end lol.