기술 자료

Unity Engine

Unity Engine

GetResolution()

Gets the resolution of the window.
읽는 시간 1분최근 업데이트: 한 달 전

Definition

public Resolution GetResolution()

Returns

Type

Description

ResolutionA Resolution object that represents the current resolution of the window.

Remarks

If the window is running in windowed mode, this function retrieves the window’s resolution, in contrast to Screen.currentResolution, which returns the resolution of the display. Note that the fetched resolution refresh rate defaults to 0 if retrieving the window's refresh rate isn't supported on the current platform.

Examples

using UnityEngine;using UnityEngine.Windowing;public class WindowResolutionExample : MonoBehaviour{ void Start() { var window = GameWindow.Main; Resolution res = window.GetResolution(); Debug.Log($"Resolution: {res.width}x{res.height} @ {res.refreshRate}Hz"); }}