EditorApplication.currentScene 当前场景


static var currentScene : string

Description描述

The path of the scene that the user has currently open (Read Only)

用户当前打开场景的路径(只读)

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

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

// saves the current scene into a new temporary scene.//存当前场景到一个新的临时场景import UnityEditor;@MenuItem ("Example/Save temp Scene %s")static function SaveTempScene() {var path : String [] = EditorApplication.currentScene.Split(char.Parse("/"));path[path.Length -1] = "Temp_" + path[path.Length-1];EditorApplication.SaveScene(String.Join("/",path));}


,