【问题标题】:How to detect available resolutions on users monitor?如何检测用户显示器上的可用分辨率?
【发布时间】:2020-01-17 12:06:14
【问题描述】:

我正在尝试为我的 Unity 游戏制作一个启动器,允许用户调整图形和音频选项。但是,我似乎找不到显示用户显示器支持的所有可能分辨率的方法。这可能吗?

乔纳森·帕尔默

【问题讨论】:

  • 很确定这是我自己理解的视频 (youtube.com/watch?v=YOaYQrN1oYQ),但如果您想要游戏的“启动器”,也可以使用显示分辨率对话框。

标签: c# windows forms unity3d launcher


【解决方案1】:

您可能正在寻找Screen.resolutions

显示器支持的所有全屏分辨率(只读)。

public class ExampleScript : MonoBehaviour
{
    void Start()
    {
        Resolution[] resolutions = Screen.resolutions;

        // Print the resolutions
        foreach (var res in resolutions)
        {
            Debug.Log(res.width + "x" + res.height + " : " + res.refreshRate);
        }
    }
}

【讨论】:

    【解决方案2】:

    Unity 解决方案是Screen.resolutions

    如果您在启动 Unity 应用程序之前寻找解决方案,则必须使用本机的东西。在 Windows 上,您可以尝试提到的解决方案 here

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多