game lost functionality after build

I am trying to make a 2D top down shooter using c# but when I build my game I lose some functionality which I do have if I run the game in the editor.

The following script is something that will do some things if the player choose to go to the next level after one is complete.

These three method calls will not execure after being built but they will in the editor:

Time.timeScale = 0;

if (Input.GetKeyDown("space")) // go to next level
    Debug.Log("Space pressed");
    Debug.Log("Loading next level");
    Application.LoadLevel(Application.loadedLevel + 1);
    Debug.Log("next level loaded");

LoadCharacter() does have a debug.log in its first line which I never get to after building. What am I doing wrong here?

This was caused by:


Because the keypress was detected from the last scene after building but not when running the game in Unity.