程序一旦建立,分辨率就会改变 [英] Resolution changes once program is built

查看:81
本文介绍了程序一旦建立,分辨率就会改变的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建1920x1080分辨率的Unity项目(与我的显示器相同).在Unity编辑器中测试程序时,一切看起来都很好-但是,一旦建立,分辨率就会变为无法使用的状态.

I am creating a Unity project in the 1920x1080 resolution (the same as my monitor). Everything looks fine when testing the program in the Unity editor - however, once built the resolution changes to an unusable state.

我可以选择更改分辨率,但是,我认为这不是问题,因为在更改设置之前就已经搞砸了分辨率.

I have an option to change the resolution, however, I don't think this is the problem as the resolution is messed up before even changing the setting.

屏幕截图: 在Unity中这里有一些代码片段,如果我过分看了看,可能会成为问题的原因.代码来自此教程.

Here are some snippets of code which could be the cause of the problem if I've over looked something. The code is from this tutorial.

void Start ()
{
     resolutions = Screen.resolutions;
     currentResolutionIndex = PlayerPrefs.GetInt(RESOLUTION_PREF_KEY, 0);
     SetResolutionText(resolutions[currentResolutionIndex]);
}

private void SetAndApplyResolution(int newResolutionIndex)
{
     currentResolutionIndex = newResolutionIndex;
     ApplyCurrentResolution();
}

private void ApplyCurrentResolution()
{
     ApplyResolution(resolutions[currentResolutionIndex]);
}

private void ApplyResolution(Resolution resolution)
{
     SetResolutionText(resolution);
     Screen.SetResolution(resolution.width, resolution.height, Screen.fullScreen);
     PlayerPrefs.SetInt(RESOLUTION_PREF_KEY, currentResolutionIndex);
}

推荐答案

为解决该问题,我刚刚使用了Unity内置的显示分辨率对话框".

To solve the problem, I've just used Unity's inbuilt 'display resolution dialogue'.

这似乎有点懒,但是,它完美地解决了该问题,并且还提供了图形选项更改.

This may seem a little lazy, however, it's solved the problem perfectly and also offers graphics option changes.

也许将来,我会回来并结合分辨率设置,但是到目前为止,启动游戏之前的短暂弹出窗口就可以了.

Maybe in the future, I'll come back and incorporate resolution settings, but as of now the short popup before launching the game is fine.

这篇关于程序一旦建立,分辨率就会改变的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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