一、需要注意的问题
1、设置屏幕分辨率,创建一个脚本,并拖动到Hierarchy视图中的一个名为Manager的空物体上
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Screen_Control : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
//设置硬件的分辨率
//Y键,设置分辨率为3840x1160
if (Input.GetKey(KeyCode.Y))
{
Screen.SetResolution(3840,1160,true);
}
//U键,设置分辨率为1920x1080
if (Input.GetKey(KeyCode.U))
{
Screen.SetResolution(1920, 1080, true);
}
//I键,设置分辨率为1600x1024
if (Input.GetKey(KeyCode.I))
{
Screen.SetResolution(1600, 1024, true);
}
//O键,设置分辨率为1600x900
if (Input.GetKey(KeyCode.O))
{
Screen.SetResolution(1600, 900, true);
}
//P键,设置分辨率为1366x768
if (Input.GetKey(KeyCode.P))
{
Screen.SetResolution(1366, 768, true);
}
//K键,设置分辨率为1280x960
if (Input.GetKey(KeyCode.K))
{
Screen.SetResolution(1280, 960, true);
}
//L键,设置分辨率为1280x800
if (Input.GetKey(KeyCode.L))
{
Screen.SetResolution(1280, 800, true);
}
//按下Esc键退出程序
if (Input.GetKey(KeyCode.Escape))
{
Application.Quit();
}
}
}
2、File-->Build Settings-->PC,Mac,Linux,Standalone-->Player Settings,填写公司名Company Name,产品名Product Name
3、生成.exe文件
在Resolution and Presentation中的Display Resolution Dialog:是否显示分辨率配置的界面
Icon:添加程序的图标
Splash Screen:程序运行时的开场动画,unity个人版中开场动画是unity自带的,无法取消,unity专业版可以取消
点击Add Open Scences,点击Build,选择保存的位置并创建
4、运行可执行文件
生成的文件分为两部分,一部分是.exe文件,一部分是一个文件夹
双击可执行文件,弹出一个分辨率对话框
启动动画后就可以看到程序了,按Esc键退出。