动态更改unity打包exe文件分辨率UI自适应+windows的标题栏

在这里插入图片描述
UICanvas更改属性参照图
Perference Pixels Per Unit 参数适当更改(根据情况而定初始值100,可不作改变)。
更改分辨率代码:

 Screen.SetResolution(Display.main.systemWidth, Display.main.systemHeight, true);

Display.main.systemWidth 渲染屏幕的宽
Display.main.systemHeight 渲染屏幕的高
true 是否全屏(true全屏,false窗口化)
windows的最小化按钮实现方式:

引入Dll:

 [DllImport("user32.dll")]
    public static extern bool ShowWindow(IntPtr hwnd, int nCmdShow);

    [DllImport("user32.dll")]
    public static extern IntPtr GetForegroundWindow();

    public const int SW_SHOWMINIMIZED = 2; //{最小化, 激活}
    ShowWindow(GetForegroundWindow(), 2);

版权声明:本文为weixin_42796768原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。