- Home /
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
Answer by clunk47 · Dec 15, 2012 at 04:57 AM
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()+"\n";
Debug.Log (supportedRes);
}
}
void OnGUI()
{
GUI.Label (new Rect(0, 0, Screen.width, Screen.height), supportedRes);
}
}
Thank you ill try this as well. But i figured out why the web player crashed. For some reason in the standalone settings the resolution was set to 9000 x 9000. I though this would have nothing to do whit the web player but apparently it does:P When i switched it to 1920 x 1080 every thing worked fine:)
Your answer
![](https://koobas.hobune.stream/wayback/20220613085405im_/https://answers.unity.com/themes/thub/images/avi.jpg)