Why does this bool get reset?

if(GUI.Button (new Rect (860,600, 20,75),“Mute(M)”,“button”) || Input.GetKeyDown(“m”))
{
AudioListener.pause = !AudioListener.pause;
print (AudioListener.pause);
}
I don’t understand. In the console it goes False and then True in the same frame. What am I missing? I press the key only once, not like I’m doing it every frame.

OnGUI (which I’m assuming is the function containing this code) is called multiple times per frame, and for that reason shouldn’t contain any game logic - only GUI code.