文档

Unity Engine

Unity Engine

GetLogicalDpi()

Gets the logical DPI of the window.
阅读时间1 分钟最后更新于 1 个月前

Definition

public float GetLogicalDpi()

Returns

Type

Description

floatThe logical DPI as a float.

Remarks

Note that the logical DPI defaults to 0 if it's not supported by the platform.

Examples

using UnityEngine;using UnityEngine.Windowing;public class LogicalDpiExample : MonoBehaviour{ void Start() { var window = GameWindow.Main; float dpi = window.GetLogicalDpi(); Debug.Log($"Logical DPI: {dpi}"); }}