Full Screen in code is different Res than from Right Click.

I’m having a problem with going to full screen using code. If I have a project that has the Default Screen Width and Height set in the Player Settings to 1024x768 and it’s Default Web Screen Width and Height is set to 600x450… then if I use the Right Click Dialog to switch to Full Screen mode it switches to the 1024x768 setting. (which is the way it is suppose to work I’m assuming)… But if I switch to Full Screen mode using code, it switches to the next closest resolution 640x480.

I’m switching to Full Screen using a key press and I added label to display the screen resolution for debugging purposes:

function Update () {
	if (Input.GetKeyDown ("f")) {
		Screen.fullScreen = !Screen.fullScreen;
	}
}

function OnGUI () {
	GUI.Label (Rect(0, 0, 300, 30), Screen.width + ":" + Screen.height);
}

Is there a way to hard code it so that when switching to Full Screen mode in code it switches to a specific resolution? In the game I’m building I would like to go to 1024x768 when the user goes fullscreen.

-Vince

Use Screen.SetResolution.