言語: 日本語
  • C#
  • JS
  • Boo

スクリプト言語

お好みのスクリプト言語を選択すると、サンプルコードがその言語で表示されます。

Screen.SetResolution

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

public static function SetResolution(width: int, height: int, fullscreen: bool, preferredRefreshRate: int = 0): void;
public static void SetResolution(int width, int height, bool fullscreen, int preferredRefreshRate = 0);
public static def SetResolution(width as int, height as int, fullscreen as bool, preferredRefreshRate as int = 0) as void

Description

画面の解像度を切り替えます

height x height の解像度が使用されます。 もし一致する解像度がサポートされていない場合、もっとも近いものが使用されます。 /preferredRefreshRate/ が 0 (デフォルト) の場合、 Unity はモニターが対応している最も大きいリフレッシュレートに切り替えます。 /preferredRefreshRate/ が 0 (デフォルト) 以外の場合、 Unity はモニターが対応していればそれを使用し、 そうでなければ対応しているもののうち、最も大きいリフレッシュレートに切り替えます。 ウェブプレイヤーではユーザがコンテンツをクリックした後にユーザにのみ解像度を切り替えます。 ユーザが専用のボタンをクリックした場合のみに解像度を切り替えることを推奨します。 Android では fullscreen は SYSTEM_UI_FLAG_LOW_PROFILE フラグを Honeycomb (OS 3.0 / API 11) 以降 View.setSystemUiVisibility() で制御します。 Windows ストア アプリ では、 Windows 8.1 以降でのみ非ネイティブ解像度に切り替えることがサポートされています。 解像度の切り替えは直ちに行なわれません。現在のフレーム完了後に実際に行なわれます。

	// Switch to 640 x 480 fullscreen

	Screen.SetResolution (640, 480, true);
using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
    void Example() {
        Screen.SetResolution(640, 480, true);
    }
}
import UnityEngine
import System.Collections

public class ExampleClass(MonoBehaviour):

	def Example() as void:
		Screen.SetResolution(640, 480, true)

他の例:

	// Switch to 640 x 480 fullscreen at 60 hz

	Screen.SetResolution (640, 480, true, 60);
using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
    void Example() {
        Screen.SetResolution(640, 480, true, 60);
    }
}
import UnityEngine
import System.Collections

public class ExampleClass(MonoBehaviour):

	def Example() as void:
		Screen.SetResolution(640, 480, true, 60)

他の例:

	// Switch to 800 x 600 windowed

	Screen.SetResolution (800, 600, false);
using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
    void Example() {
        Screen.SetResolution(800, 600, false);
    }
}
import UnityEngine
import System.Collections

public class ExampleClass(MonoBehaviour):

	def Example() as void:
		Screen.SetResolution(800, 600, false)

See Also: resolutions プロパティ