OnApplicationPause Crashes Unity

Hi

I have the following script running on my app, so that if the game is interuppted (goes into hibernate, or user gets a phone call etc), then the pause screen will be on and the game paused when the player returns to the game from the home menu:

function OnApplicationPause () {
    Time.timeScale = 0.0;
    //all the pause screen code is in here, just took it out because it's not relevant.... e.g. displays the pause menu and its buttons...
}

This works fine when built to the phone. However, if I press Play in the Unity editor, Unity crashes from the above. Anything I’m doing wrong?

Thanks

Hm, so noone has come across this? Or can offer a solution/something for me to check? It kind of tells me that the editor is in the pause state when it first starts up perhaps??? Don’t know, just clutching at straws atm!!

try

function OnApplicationPause (pause : boolean){
 if(pause) //pause code
 else //unpause code
}

Hm okay i’ll give that a shot, thanks.