Game-killing bug caused by having an 'if' statement in the OnGUI function

I ran into a very strange bug that I tracked to being caused by having a GUI element (window,button,label…doesn’t matter) being dependent on an if statement within the OnGUI function. For example:

void OnGUI ()
{
      if ( condition )
      {
           // Show some GUI element
      }
}

The basic gist of the bug goes like this:
For simplicity’s sake, lets say I have a project with two scenes; the first one is a ‘main menu’ scene that has GUI elements that are NOT reliant on conditional statements. One of the buttons in this ‘main menu’ scene loads up the second scene which is the ‘game scene.’ The ‘game scene’ has some GUI elements that ARE reliant on a conditional statement so that they will only be active when the player pauses the game. One of the buttons in this ‘game scene’ will load back to the ‘main menu scene.’ In both scenes, loading is handled by a run-of-the-mill Application.LoadLevel() call.
So I start the ‘main menu’ scene and press the button to load the ‘game scene.’ The ‘game scene’ loads perfectly and everything is functional. I then bring up the pause menu in the ‘game scene’ and press the button to go back to the ‘main menu’ scene. The ‘main menu’ scene loads perfectly.
I then press the button to once again load back to the ‘game scene’ and here’s where it all goes to hell: The ‘game scene’ does load, but nothing works. No input, no scripts doing what they’re supposed to, no default animations…just a dead scene. It’s not frozen because the main thread and fps are still active in Unity’s “stats” window.

I know what you’re thinking: it has to be something else in my project that’s causing this to occur, there’s no way it’s just from having an ‘if’ statement in the OnGUI function. But trust me, I just spent an entire night isolating this bug (I had no idea what was causing it starting out, thank god I at least found it), and after trouble-shooting everything under the sun it is without a doubt caused by this. I even created whole new projects with empty bare-bone scenes and everytime I was able to replicate the bug exactly.

The even stranger thing is I loaded up an old project from back in December and it didn’t have the bug at all…just in my current project and any new project I create.

Apologies for the long ass post, I’m completely bewildered by this and I’m hoping someone has some idea what the deal is. Thanks for reading and for any help/suggestions you might have.

Figured it out. I actually feel kind of stupid… it turns out it was my code all along. When pausing the game I was setting Time.timeScale to 0, but I had nothing changing it back to 1 when I pressed the button to return to the main menu. It finally hit me that, oh yeah, Time.timeScale is a global variable and won’t reset by changing scenes. :?