Script don't run completely

I have the problem, that some scripts don’t run completely.
Script example:
function manipulate(){

    if(Input.GetKeyDown(KeyCode.E) && !ShowContContent && Inv.Movement && !Locked){
		ContOpen.Play();
		ShowContContent = true;
		Inv.Movement = false;
		Inv.ShowCon = true;
   }

}

function OnGUI(){

	if (ShowContContent){
	
	    GUI.DrawTexture(Rect(0, 0, Screen.width, Screen.height), ContBackground, ScaleMode.StretchToFill);

       [...]
       }

}

If i hit the key, the sound plays, but nothing else happens. That means, the script runs, but not completely. Most times when the window is open already, so I can’t leave the window anymore. By buttonsmashing it works sometimes once per 30 inputs.
I think it could be caused by the framerate.
What can I do to fix that?

I can’t see anything there that would prevent the script from running.

Are you setting ShowContContent to false anywhere? Perhaps when releasing the ‘E’ button or in an update routine?

Easiest thing to do is to set a breakpoint in your code and follow it through - check that your variables are set correctly and that the OnGUI function is called and run as expected. If you’re not sure how to use the debugger then take a look here: https://unity3d.com/learn/tutorials/modules/beginner/scripting/monodevelops-debugger (or you can just put in some Debug.Log(“test”) calls)