Fullscreen Toggle Issue

Hi all, fullscreen toggling should be a relativley simple thing to sort out, but ever since day one I've had a problem which I cant seem to solve.

The following function runs all the time (from the update) and waits for a key input, no problems there and infact the variable isFullScreen gets changed as required, however the screen doesnt go fullscreen until you press the buttons again..and of course at that point the var gets set back to false so effectiveley the code works but ONLY if you press the buttons twice each time you want to toggle. Any ideas?

function FullScreenToggle()
{
    fullScreenToggleKeyPressed= Input.GetKeyDown(fullScreenToggleKey); 

    if(fullScreenToggleKeyPressed&&Input.GetKey (KeyCode.LeftShift)&&Input.GetKey (KeyCode.LeftAlt))
    {
        if (isFullScreen==false)
            {
                //this is some kind of error need to try !Screen.fullScreen; ? To test neeed a separate build.
                Screen.fullScreen = Screen.fullScreen;
                isFullScreen=true;
                return;
            }
        if (isFullScreen)
            {
                Screen.fullScreen = !Screen.fullScreen;
                isFullScreen=false;
                return;
            }
    }

}

Is this in the webplayer? If so, thats been designed so that the user needs to click on the screen to allow it to go into fullscreen mode.

Your problem is this line of code, which doesn't do anything:

`

Screen.fullScreen = Screen.fullScreen;
`

You don't really need to use a variable to keep track of isFullScreen. Simply read Screen.fullScreen to find out if it is currently full screen.

Here is how I got it to work for me (c#):

void Update(){
if(Input.GetKeyUp(KeyCode.F))
   ToggleFullScreen();
}

void ToggleFullScreen(){
   if(Screen.fullScreen= !Screen.fullScreen){
      Screen.fullScreen = Screen.fullScreen;
      Screen.SetResolution(Screen.width, Screen.height, true, 60);
}else{
   Screen.fullScreen = !Screen.fullScreen;
}

Hope it helps somebody.