1. 勾上下图标红处,发布后可防止按windows键缩小
2.发布后程序默认最小化文章来源:https://www.toymoban.com/news/detail-533319.html
using System;
using System.Runtime.InteropServices;
using UnityEngine;
/// <summary>
/// 开始时最小化窗口
/// </summary>
public class SetWindowMin : MonoBehaviour
{
[DllImport("user32.dll")]
public static extern bool ShowWindow(IntPtr hwnd, int nCmdShow);
[DllImport("user32.dll")]
static extern IntPtr GetActiveWindow();
const int SW_SHOWMINIMIZED = 2; //{最小化, 激活}
const int SW_SHOWMAXIMIZED = 3;//最大化
const int SW_SHOWRESTORE = 1;//还原
private void Start()
{
ShowWindow(GetActiveWindow(), SW_SHOWMINIMIZED);
}
}
3.发布的程序只能开一个进程文章来源地址https://www.toymoban.com/news/detail-533319.html
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using UnityEngine;
public class Process_sigle : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
//检测是否打开
Process[] app = Process.GetProcessesByName("Da_Ping_show");
if (app.Length >1)
{
for (int i =1; i < app.Length; i++)
{
app[i].Kill();
}
return;
}
}
}
到了这里,关于unity发布设置(最小化、置顶、限制单开)的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!