文档

Unity Engine

Unity Engine

GetDisplayInfo()

Gets the display information of the display that holds the window.
阅读时间1 分钟最后更新于 1 个月前

Definition

public DisplayInfo GetDisplayInfo()

Returns

Type

Description

DisplayInfoA DisplayInfo object with the display details.

Examples

using UnityEngine;using UnityEngine.Windowing;public class DisplayInfoExample : MonoBehaviour{ void Start() { var window = GameWindow.Main; DisplayInfo info = window.GetDisplayInfo(); Debug.Log($"Display: {info.name}, Resolution: {info.width}x{info.height}"); }}