当前位置: 首页 > news >正文

Unity 打包程序全屏置顶无边框

该模块功能: 

1. 打包无边框

2. 置顶

3. 不允许切屏

4.多显示器状态下,程序只在主显示上运行 

5.全屏

Unity 打包设置:

如果更改打包设置,最好将Version版本增加一下,否则可能不会覆盖前配置文件

代码: 挂在场景中即可 

using UnityEngine;
using System; // 确保这行存在
using System.Runtime.InteropServices;public class WindowTopMost : MonoBehaviour
{
#if !UNITY_EDITOR && UNITY_STANDALONE_WIN[DllImport("user32.dll")]private static extern bool SetWindowPos(IntPtr hwnd, IntPtr hwndInsertAfter, int x, int y, int cx, int cy, uint flags);[DllImport("user32.dll")]private static extern IntPtr GetActiveWindow();private static readonly IntPtr HWND_TOPMOST = new IntPtr(-1);private const uint SWP_NOSIZE = 0x0001;private const uint SWP_NOMOVE = 0x0002;private const uint SWP_SHOWWINDOW = 0x0040;void Start(){Screen.SetResolution(Display.main.systemWidth, Display.main.systemHeight, FullScreenMode.FullScreenWindow);Invoke("SetWindowTopMost", 0.5f);}void SetWindowTopMost(){IntPtr windowPtr = GetActiveWindow();SetWindowPos(windowPtr, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);}
#endif
}

相关文章:

  • Docker端口映射与容器互联
  • 从 Docker 到 runC
  • 微信小程序:列表项上同样的css样式在IOS上字体大小不一样
  • uniapp uts 插件开发指南
  • 电路图识图基础知识-电气符号(二)
  • Nginx-配置详解
  • 【论文精读】2023 CVPRW--EAVSR现实世界视频超分辨率(RealWorld VSR)
  • 响应面法(Response Surface Methodology ,RSM)
  • 鸿蒙Ability对比Android的Fragment
  • CSS2相关知识点
  • IvorySQL-WASM:免安装的数据库探索之旅
  • 【沉浸式求职学习day47】【JSP详解】
  • [Datagear] [SQL]实现分组统计同时带汇总行的两种方式对比分析
  • 深入理解会话管理:Cookie、Session与JWT的对比与应用
  • windows 下用yolov5 训练模型 给到opencv 使用
  • leetcode:2469. 温度转换(python3解法,数学相关算法题)
  • 一、ZooKeeper:分布式系统中的隐形协调大师
  • Seismic source model -- Brune model ( ω^2 model)
  • 静态时序分析与约束
  • MATLAB NLP 工具箱 文本预处理教程
  • 杨庄网站建设/新品怎么推广效果最好
  • 邯山区建设局网站/360浏览器网页版入口
  • 国外免费b2b网站大全黄页/快速刷排名seo软件
  • 网站制作的基本步骤/2023年8月新闻热点事件
  • java建设网站的步骤/北京企业网站推广哪家公司好
  • h5网站开发多少钱/南昌seo搜索优化