unity web player fatal error couldn't switch to requested monitor resolution

Hi guys

So we made a web player for a project, the resolution is 900 x 400 and i made a button in the web player so the user can toggle to full screen mode.
I used this piece of code to switch to full screen.

public class example : MonoBehaviour {
void Example() {
Screen.fullScreen = !Screen.fullScreen;
}
}

I tested it on a bunch of different computers and it works fine.
But i have found that there where some computers that crashed when i pressed to full screen button and i got this fatal error message -

  • couldn’t switch to requested monitor resolution -’

Now i have looked on the web and on the unity forums for a solution but can’t find anything.

Now i was hoping anyone here had a similar problem and knows why the web player crashes.
Or can point me in the right direction to fix it.

thanks

900 x 400 is a very odd resolution. Some monitors simply don’t support it. If something is windowed, won’t be a problem. But if the fullscreen resolution is not supported by the monitor, or the aspect ratio of that resolution is not supported by that specific monitor, it simply won’t work. Besides, running unsupported resolutions can damage a display… One way to find out supported resolutions would be to use an array in a script for Screen.resolutions…

Here’s a simple GUI script I wrote that you can attach to the main camera or anything else… If you run in the editor, the only resolution shown will be 640x480. But when you BUILD this as an EXE, then run the exe, it will tell you all the supported resolutions for the specific display it is running on. Hope this helps.

using UnityEngine;
using System.Collections;

public class getResolutions : MonoBehaviour 
{
	Resolution[] resolutions;
	string supportedRes;
	
	void Start()
	{
		resolutions = Screen.resolutions;
		foreach(Resolution r in resolutions)
		{
			supportedRes+= r.width.ToString()+" x "+r.height.ToString()+"

";
Debug.Log (supportedRes);
}
}
void OnGUI()
{
GUI.Label (new Rect(0, 0, Screen.width, Screen.height), supportedRes);
}

}