您当前的位置: 首页 >  unity

程序员正茂

暂无认证

  • 3浏览

    0关注

    283博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

Unity显示到多个扩展屏

程序员正茂 发布时间:2019-09-08 23:43:47 ,浏览量:3

1.PlayerSetting发布设置

2.启动时设置分辨率和位置

public class MainDisplay : MonoBehaviour {

 //导入设置窗口函数
    [DllImport("user32.dll")]
    public static extern bool SetWindowPos(System.IntPtr hWnd, int hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags);
    //导入当前活动窗口
    [DllImport("user32.dll")]
    public static extern IntPtr GetActiveWindow();
    //显示窗口
    public const uint SWP_SHOWWINDOW = 0x0040;
    void Start () {
        //最后一个参数必须为false,不能直接全屏
        Screen.SetResolution(7560, 1920, false);

       //-30为了隐藏标题栏,+50是为了遮挡任务栏,任务栏需要设成自动隐藏
        SetWindowPos(GetActiveWindow(), -1, 0, -30, 7560, 1920 + 50, SWP_SHOWWINDOW);
    }
}

 

关注
打赏
1660743125
查看更多评论
立即登录/注册

微信扫码登录

0.0364s