Unity freezes at the following code

while(Input.GetKeyDown (KeyCode.Space))


rigidbody2D.AddForce(transform.up * 99990 * Time.deltaTime);

The while-loop is something that keeps on running until the condition becomes false. When it is looping the thread can’t execute any other code so if you have that in your Update() method, the code will get stuck in the while loop for all eternity if you press Space.

Replace the word “while” with “if”.

As NoseKills correctly says, you problem is that this is an idiot loop:
while(Input.GetKeyDown (KeyCode.Space))

The reason it is an idiot loop is because calling GetKeyDown does not clear the key. It will continue to return the same key for the entire update.