Unity中开发程序打包发布

添加ESC脚本

使用Unity打包发布的过程中,考虑到打开的程序会处于全屏界面,而此时我们又会有退出全屏的需求,因此需要添加ESC脚本,当我们单击ESC脚本的过程中,退出全屏模式。

在Assets/Scenes下,创建esc.cs脚本,脚本内容如下:

csharp 复制代码
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class esc : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        if(Input.GetKey(KeyCode.Escape))
        {
            Screen.fullScreen = false; // 单击按钮ESC退出全屏
        }
        
    }
}

添加完成后,可将esc.cs脚本改在到任意控件下。

打包发布

1、单击File->build settings,单击Add Open Scenes,添加目标Scene,然后单击Player Setting。

2、修改公司名称、产品名称、版本号等基础信息,并设置软件的初始全屏模式。

3、关掉上述窗口,单击下图中的Build按钮,选择相应的文件夹,进行发布即可。

4、至此,即可在目标文件中查看生成的目标exe后缀文件,运行即可。

相关推荐
狂人开飞机35 分钟前
14、游戏手感与视觉打磨
游戏·游戏引擎·godot
狂人开飞机6 小时前
15、音频系统
游戏引擎·godot
狂人开飞机6 小时前
16、粒子线条与视觉特效
游戏引擎·godot
心前阳光18 小时前
Unity发布PC软件图标不能改变
unity·游戏引擎
an86950011 天前
unity如何在visual studio中打断点debug
unity·游戏引擎·visual studio
xcLeigh1 天前
Unity基础:使用Transform控制物体移动——Translate与position详解
unity·游戏引擎
FairGuard手游加固1 天前
Unity小游戏加密:global-metadata.dat与AssetBundle保护
游戏·unity·游戏引擎
狂人开飞机1 天前
11、UI系统
游戏引擎·godot
真鬼1231 天前
【Unity AI】Untiy链接cursor与MCP
unity·游戏引擎
WarPigs1 天前
Unity设置人物位置无效的原因
unity