EditorApplication.Exit 退出

static function Exit (returnValue : int) : void

Description描述

Exit the Unity editor application.

退出Unity编辑器程序。

Calling this function will exit right away, without asking to save changes, so you may lose data! This function is mostly useful for exiting out of a commandline process with a specific error.

用这个函数会立即退出,不会询问是否需要保存更改,所以你可能丢失数据!这个函数在退出处理特殊错误的命令行时有用。

// Simple script that lets you create a new
// scene, create a cube and an empty game object in the scene
//简单的脚本, 可以让你新建一个新的场景, 新建一个立方体和场景中的一个空物体
// Save the scene and close the editor
//保存场景并且关闭编辑器

import UnityEditor;

@MenuItem ("Example/Chain Actions and close")
static function Chain() {
	EditorApplication.NewScene();

	EditorApplication.ExecuteMenuItem("GameObject/Create Other/Cube");
	EditorApplication.ExecuteMenuItem("GameObject/Create Empty");

	EditorApplication.SaveScene("Assets/MyNewScene.unity");
	EditorApplication.Exit(0);
}
最后修改:2011年6月25日 Saturday 21:12

本脚本参考基于Unity 3.4.1f5

英文部分版权属©Unity公司所有,中文部分© Unity圣典 版权所有,未经许可,严禁转载 。