EditorApplication.applicationPath 应用程序路径

static var applicationPath : string

Description描述

Returns the path to the Unity editor application (Read Only)

返回Unity编辑器应用程序的路径(只读)。

参见:applicationContentsPath.

// This example lets you load Editor scripts
// automatically to your current working project
//这个例子使你自动加载编辑器脚本到你当前的工作项目
// Just place your editor scripts next to where the Unity binary
// resides.
//只需要你把编辑器类放到unity二进制文件的路径下即可

@MenuItem("Example/Load Editor Scripts")
static function LoadEditorScripts() {
	// Get the editor folder that resides next to the Unity exec
	//得到在unity可执行文件目录下的editor文件夹
	var appPath : String[] = EditorApplication.applicationPath.Split(char.Parse("/"));
	appPath[appPath.Length -1] = "Editor";
	var editorFolder : String = String.Join("/",appPath);
	Debug.Log("Loading editor scripts at: " + editorFolder);
	FileUtil.CopyFileOrDirectory(editorFolder,"Assets/");
}
最后修改:2011年6月25日 Saturday 19:01

本脚本参考基于Unity 3.4.1f5

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