简体   繁体   English

unity windowed mode size 在不同的屏幕分辨率上是不同的

[英]Unity windowed mode size is different on different screen resolutions

So I want the window size in the build to be of a certain size and it works great when displayed on 1920 x 1080 screen resolution, anything more or less than that, and the window becomes too big or too small.因此,我希望构建中的 window 尺寸具有一定的尺寸,并且在以 1920 x 1080 的屏幕分辨率(或多或少)显示时效果很好,并且 window 变得太大或太小。 Is there any way for the window to be of the same window to screen size resolution?有什么方法可以让 window 与屏幕尺寸分辨率相同 window?

I have used the following settings:我使用了以下设置:

My build settings我的构建设置

Afaik you can set the resolution depending on the Display screen size using Screen.currentResolution and Screen.SetResolution somewhat like eg Afaik 您可以使用Screen.currentResolutionScreen.SetResolution根据显示屏幕大小设置分辨率,有点像例如

public class ScreenSizeController : MonoBehaviour
{
    // how much space (percentage) of the screen should your window fill
    [Range(0f,1f)]
    public float fillX;
    [Range(0f,1f)]
    public float fillY;

    private void Awake()
    {
        // Get actual display resolution
        var res = Screen.currentResolution;

        // calculate target resolution using the fill
        var targetX = fillX * res.width;
        var targetY = fillY * res.height;

        // Set player resolution
        Screen.SetResolution(targetX, targetY, false);
    }
}

Note: Typed on smartphone but I hope the idea gets clear注意:在智能手机上输入,但我希望这个想法很清楚

Wouldn't changing the screen width/height in the resolution and presentation menu to 1920 x 1080 fix it不会将分辨率和演示菜单中的屏幕宽度/高度更改为 1920 x 1080 修复它

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在Unity3D中,如何使板子居中放置不同的屏幕尺寸? - How to keep my board in the center for different screen size in Unity3D? 如何在xaml中创建一个导航栏,可以在不同的屏幕分辨率下进行缩放? - How to create a navigation bar in xaml, which can scale with different screen resolutions? 网站在不同屏幕尺寸下的显示方式不同 - Website display differently with different screen size 如何在JavaFx中为不同的分辨率自动调整窗口大小? - How to automatically resize windows in JavaFx for different resolutions? RegEnumValue在Vista兼容模式下返回不同的缓冲区大小 - RegEnumValue returns different buffer size in Vista compatibility mode 如何在开发Windows Phone 7应用程序时处理不同的屏幕尺寸 - How to handle different screen size while developing windows phone 7 app 在窗口信息亭模式下运行 Chrome - Run Chrome in Windowed Kiosk Mode 当分辨率不同时,将 RDP 的显示限制为 2 个而不是 3 个 - Limiting display of RDP to 2 monitors instead of 3 when they have different resolutions Unity- 窗口化全屏黑色边框 - Unity- windowed fullscreen black borders !address命令显示用户模式堆栈初始提交大小的不同值 - !address command shows a different value for the User mode stack initial commit size
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM