Unity独立构建自动检测分辨率 [英] Unity standalone build auto detect resolution

查看:346
本文介绍了Unity独立构建自动检测分辨率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为Mac和Windows创建一个Unity应用. 当我将其构建为独立版本并打开app/exe文件时,它会显示一个屏幕,供您选择分辨率和其他一些选项. 是否有可能使其自动检测当前计算机的分辨率(为此编写脚本)并在我们双击exe或应用程序文件并正确以该分辨率打开时自动打开窗口,而无需显示该屏幕来选择分辨率.

如果可能的话,请让我知道我该怎么做.

谢谢

解决方案

Screen.SetResolution (Screen.currentResolution.width, Screen.currentResolution.height, true);

这会将其设置为全屏并检测您当前的桌面分辨率.

要返回窗口模式,请使用

Screen.SetResolution (1024, 768, false); //enter res

大多数人遇到的问题是调整GUI的大小,这超出了我在Unity3D中的知识范围.希望对您有所帮助.

I'm creating a Unity app for Mac and Windows. When I build it as standalone and open the app/exe file it gives a screen to select the resolution and some other options. Is it possible to make it auto detect the current computer's resolution(by writing a script for that) and auto open the window when we double click the exe or app file and open with that resolution correctly without showing that screen to select resolution.

If it's possible please let me know how I can do that.

Thanks

解决方案

Screen.SetResolution (Screen.currentResolution.width, Screen.currentResolution.height, true);

This sets it to fullscreen and detects your current desktop resolution.

To go back to windowed mode use

Screen.SetResolution (1024, 768, false); //enter res

The problem most people have is resizing the GUI, which is beyond my range of knowledge in Unity3D. Hope that helps you a little.

这篇关于Unity独立构建自动检测分辨率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆