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/");

}
Page last updated: 2011-6-25