EditorApplication.OpenSceneAdditive 打开附加路径场景

static function OpenSceneAdditive (path : string) : void

Description描述

Opens the scene at path additively.

打开在附加路径的场景。

All paths are relative to the project folder. Like: "Assets/MyScenes/MyScene.unity"

所有的路径都是相对于工程文件夹. 例如” Assets/MyScenes/MyScene.unity”

// Simple script that lets you load the contents of a selected scene
// to your current scene.
//简单的脚本,可以使你加载被选中场景内容到你当前的场景中
@MenuItem("Example/Load Scene Additive")
static function Apply () {
	var strScenePath : String = AssetDatabase.GetAssetPath(Selection.activeObject);
	if (strScenePath == null || !strScenePath.Contains(".unity")) {
		EditorUtility.DisplayDialog("Select Scene", "You Must Select a Scene!", "Ok");
		EditorApplication.Beep();
		return;
	}
	Debug.Log("Opening " + strScenePath + " additively");
	EditorApplication.OpenSceneAdditive(strScenePath);
}
最后修改:2011年6月25日 Saturday 19:56

本脚本参考基于Unity 3.4.1f5

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