Legacy Documentation: Version 5.3
LanguageEnglish
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

PlayerSettings.defaultIsFullScreen

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Sumbission failed

For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Switch to Manual
public static var defaultIsFullScreen: bool;
public static bool defaultIsFullScreen;

Description

If enabled, the game will default to fullscreen mode.

The Windowed checkbox on the Resolution Dialog will be disabled by default when this setting is enabled.


Custom player settings.

#pragma strict
public class CustomSettings extends EditorWindow {
	var compName: String;
	var prodName: String;
	var screenWidth: int = 640;
	var screenHeight: int = 480;
	var webScreenWidth: int = 640;
	var webScreenHeight: int = 480;
	var fullScreen: boolean = false;
	@MenuItem("Examples/Custom Settings")
	static function Init() {
		var window: EditorWindow = EditorWindow.GetWindow.<CustomSettings>();
		window.Show();
	}
	function OnGUI() {
		compName = EditorGUILayout.TextField("Company Name:", compName);
		prodName = EditorGUILayout.TextField("Product Name:", prodName);
		EditorGUILayout.BeginHorizontal();
		screenWidth = EditorGUILayout.IntField("Width:", screenWidth);
		screenHeight = EditorGUILayout.IntField("Web Height:", screenHeight);
		EditorGUILayout.EndHorizontal();
		EditorGUILayout.Space();
		EditorGUILayout.BeginHorizontal();
		webScreenWidth = EditorGUILayout.IntField("Web Width:", webScreenWidth);
		webScreenHeight = EditorGUILayout.IntField("Web Height:", webScreenHeight);
		EditorGUILayout.EndHorizontal();
		fullScreen = EditorGUILayout.Toggle("Full Screen:", fullScreen);
		EditorGUILayout.BeginHorizontal();
		if (GUILayout.Button("Save Values"))
			SaveSettings();
		if (GUILayout.Button("Load Values"))
			LoadSettings();
		EditorGUILayout.EndHorizontal();
	}
	function SaveSettings() {
		PlayerSettings.companyName = compName;
		PlayerSettings.productName = prodName;
		PlayerSettings.defaultScreenWidth = screenWidth;
		PlayerSettings.defaultScreenHeight = screenHeight;
		PlayerSettings.defaultWebScreenWidth = webScreenWidth;
		PlayerSettings.defaultWebScreenHeight = webScreenHeight;
		PlayerSettings.defaultIsFullScreen = fullScreen;
		EditorPrefs.SetString("CompName", compName);
		EditorPrefs.SetString("ProdName", prodName);
		EditorPrefs.SetInt("ScreenWidth", screenWidth);
		EditorPrefs.SetInt("ScreenHeight", screenHeight);
		EditorPrefs.SetInt("WebScreenWidth", webScreenWidth);
		EditorPrefs.SetInt("WebScreenHeight", webScreenHeight);
	}
	function LoadSettings() {
		compName = EditorPrefs.GetString("CompName", "");
		prodName = EditorPrefs.GetString("ProdName", "");
		screenWidth = EditorPrefs.GetInt("ScreenWidth", 640);
		screenHeight = EditorPrefs.GetInt("ScreenHeight", 480);
		webScreenWidth = EditorPrefs.GetInt("WebScreenWidth", 640);
		webScreenHeight = EditorPrefs.GetInt("WebScreenHeiht", 480);
	}
}
using UnityEngine;
using UnityEditor;

public class CustomSettings : EditorWindow { string compName; string prodName; int screenWidth = 640; int screenHeight = 480; int webScreenWidth = 640; int webScreenHeight = 480; bool fullScreen = false;

[MenuItem("Examples/Custom Settings")] static void Init() { EditorWindow window = EditorWindow.GetWindow<CustomSettings>(); window.Show(); }

void OnGUI() { compName = EditorGUILayout.TextField("Company Name:", compName); prodName = EditorGUILayout.TextField("Product Name:", prodName);

EditorGUILayout.BeginHorizontal(); screenWidth = EditorGUILayout.IntField("Width:", screenWidth); screenHeight = EditorGUILayout.IntField("Web Height:", screenHeight); EditorGUILayout.EndHorizontal();

EditorGUILayout.Space();

EditorGUILayout.BeginHorizontal(); webScreenWidth = EditorGUILayout.IntField("Web Width:", webScreenWidth); webScreenHeight = EditorGUILayout.IntField("Web Height:", webScreenHeight); EditorGUILayout.EndHorizontal();

fullScreen = EditorGUILayout.Toggle("Full Screen:", fullScreen); EditorGUILayout.BeginHorizontal();

if(GUILayout.Button("Save Values")) SaveSettings();

if(GUILayout.Button("Load Values")) LoadSettings();

EditorGUILayout.EndHorizontal(); }

void SaveSettings() { PlayerSettings.companyName = compName; PlayerSettings.productName = prodName; PlayerSettings.defaultScreenWidth = screenWidth; PlayerSettings.defaultScreenHeight = screenHeight; PlayerSettings.defaultWebScreenWidth = webScreenWidth; PlayerSettings.defaultWebScreenHeight = webScreenHeight; PlayerSettings.defaultIsFullScreen = fullScreen;

EditorPrefs.SetString("CompName", compName); EditorPrefs.SetString("ProdName", prodName); EditorPrefs.SetInt("ScreenWidth", screenWidth); EditorPrefs.SetInt("ScreenHeight", screenHeight); EditorPrefs.SetInt("WebScreenWidth", webScreenWidth); EditorPrefs.SetInt("WebScreenHeight", webScreenHeight); }

void LoadSettings() { compName = EditorPrefs.GetString("CompName",""); prodName = EditorPrefs.GetString("ProdName",""); screenWidth = EditorPrefs.GetInt("ScreenWidth", 640); screenHeight = EditorPrefs.GetInt("ScreenHeight",480); webScreenWidth = EditorPrefs.GetInt("WebScreenWidth",640); webScreenHeight = EditorPrefs.GetInt("WebScreenHeiht",480); } }