webplayer resolution problems/issues/oddities and frame rate weirdness

I can't get full screen playing in the webplayer to run at the native resolution of my screen, despite setting webplayer build to exactly the screen resolution. But more annoying, regardless what I set the webplayer resolution, I get aspect ratio stretching when going to full screen, AND it's playing full screen at a clearly lower resolution (blocky pixels) than the in browser setup.

How do I force fullscreen webplayer to a specific resolution?

I've tried this, http://answers.unity3d.com/questions/23307/webplayer-fullscreen-aspect-ratio-wrong , but it has no impact, other than showing me that at 1920 x 1080 I can get uber fluid frames per second for a while.

Which brings up another odd point, after a little time the webplayer frame rate degrades horribly, to well below 30 frames per second, at which point nothing brings it back up. I can refresh the page/reload the game, but the frame rate remains low. However if I rebuild, without changing anything other than the filename, it goes back up until the degradation occurs again.

I've watched memory and cpu usage during this degradation and gameplay, it doesn't change throughout.

Fullscreen play is not hampered by this framerate degradation.

Setting the web player window resolution to your screen resolution can't work, because you always have window borders and stuff around the window. The web player will never go higher than the native resolution when switched to full-screen, so set the screen resolution (not the web player window resolution) to something like 9000 x 9000.

When switching to fullscreen, I'm getting better and more predictable results with:

Screen.SetResolution (9000, 9000, true);

vs.

Screen.fullScreen = true;

...than by depending on the project settings of the standalone & webplayer. Particularly when running in the webplayer, the first approach takes care of the resolution problem.

In Unity 4.5 you need to adjust the player settings for ‘PC, Mac & Linux’ - uncheck all the boxes for ‘Supported Aspect Ratios’, then you’ll get fullscreen web playback.

Have just found a solution based on the previous answers:

var fullscreenIcons: Texture[];
private var sw: int[];
private var sh: int[];
private var k: int = 0;

function Start () {
    sw = [Screen.width,Screen.currentResolution.width];
sh = [Screen.height,Screen.currentResolution.height];
}

function OnGUI () {
//fullscreen switch
if(GUI.Button (Rect(sw[k] - 60,20,40,40), fullscreenIcons[k])){
    k = (k + 1)%2;
    if(k==0) Screen.SetResolution (sw[0], sh[0], false);
    if(k==1) Screen.SetResolution (Screen.currentResolution.width, Screen.currentResolution.height, true);
}

Beacause I do not know ahead of time the full screen resolution for the webplayer, I set the standalone res to 9000x9000 When I go full screen the aspect ratio seems correct but the res is not 1900x1600

Use Direct3D 9 instead of 11 => boom, it works! (at least for me) And I have no glitches with D3D9, whereas with D3D11 my windows are a bit messed up once I leave fullscreen mode in my web player game.

It’s true though that the desktop resolution settings corresponds (roughly) to the web player fullscreen resolution setting, but only with D3D9.