1.代码
/*Type:设置分辨率*/
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
using System.Runtime.InteropServices;public class ScreenManager : MonoBehaviour
{[HideInInspector]//导入设置窗口函数 [DllImport("user32.dll")]static extern bool SetWindowPos(IntPtr hWnd, int hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags);[DllImport("user32.dll")]static extern IntPtr SetWindowLong(IntPtr hwnd, int _nIndex, int dwNewLong);//导入当前活动窗口 [DllImport("user32.dll")]static extern IntPtr GetActiveWindow();const uint SWP_SHOWWINDOW = 0x0040;//显示窗口const int GWL_STYLE = -16;const int WS_BORDER = 1;// public JsonDatas _JsonDatas;private void Awake(){//_JsonDatas = JsonLoad.Instance.LoadJsonDatas<JsonDatas>(Application.streamingAssetsPath + "/Json/JsonDate.json");}void Start(){//编辑器状态下脚本不执行,发布exe脚本执行
#if !UNITY_EDITOR//去掉上面的框SetWindowLong(GetActiveWindow(), GWL_STYLE, WS_BORDER);//显示范围SetWindowPos(GetActiveWindow(), -1, 0, 0, 5760, 1080, SWP_SHOWWINDOW);//三个1920x1080的屏幕
#endif}
}
2.发布设置