EditorApplication 编辑器应用程序


Main Application class.

主应用程序类。

Note: This is an editor class. To use it you have to place your script in Assets/Editor inside your project folder. Editor classes are in the UnityEditor namespace so for C# scripts you need to add "using UnityEditor;" at the beginning of the script.
 注意:这是一个编辑器类,如果想使用它你需要把它放到工程目录下的Assets/Editor文件夹下。编辑器类在UnityEditor命名空间下。所以当使用C#脚本时,你需要在脚本前面加上 "using UnityEditor"引用。

Class Variables类变量

  • currentScene
    The path of the scene that the user has currently open (Read Only)
       用户当前打开场景的路径(只读)
  • isPlaying
    Is editor currently in play mode?
       编辑器当前是否在播放模式?
  • isPlayingOrWillChangePlaymode
    Is editor either currently in play mode, or about to switch to it? (Read Only)
       当前编辑器是否在播放模式或者即将切换到播放模式(只读)。
  • isPaused
    Is editor currently paused?
       当前编辑器是否暂停?
  • isCompiling
    Is editor currently compiling scripts? (Read Only)
       当前编辑器是否在编译脚本(只读)?
  • applicationContentsPath
    Path to the Unity editor contents folder (Read Only)
       到Unity编辑器内容文件夹的路径(只读)。
  • applicationPath
    Returns the path to the Unity editor application (Read Only)
       返回Unity编辑器应用程序的路径(只读)。
  • projectWindowItemOnGUI
    Delegate for OnGUI events for every visible list item in the ProjectWindow.
       委托用于OnGUI事件在项目窗口每个可见列表项。
  • hierarchyWindowItemOnGUI
    Delegate for OnGUI events for every visible list item in the HierarchyWindow.
       委托用于OnGUI事件在层级窗口每个可见列表项。
  • update
    Delegate for generic updates.
       通用更新的委托。
  • modifierKeysChanged
    Delegate for changed keyboard modifier keys.
       用于改变的键盘修改键(组合键)的委托。
  • playmodeStateChanged
    Delegate for play mode state changes.
       对播放模式状态改变的委托。
  • timeSinceStartup
    The time since the editor was started (Read Only)
        从编辑器打开至今的时间(只读)。

Class Functions类函数

  • NewScene
    Create a new scene // 创建一个新的场景。
  • OpenScene
    Opens the scene at path. // 打开指定路径下的场景。
  • OpenSceneAdditive
    Opens the scene at path additively.
       打开在附加路径的场景。
  • SaveScene
    Save the scene at path. // 保存场景到指定路径。
  • SaveCurrentSceneIfUserWantsTo
    Ask the user if he wants to save the open scene.
       询问用户是否要保存当前场景。
  • OpenProject
    Open another project. // 打开另外一个工程。
  • SaveAssets
    Saves all serializable assets that have not yet been written to disk (eg. Materials)
       保存所有未写入磁盘可序列化的资源(例如,材质)。
  • Step
    Perform a single frame step.
       执行单帧。就是一帧一帧的执行。
  • LockReloadAssemblies
    Prevents loading of assemblies when it is inconvenient.
       当编辑器不便时,阻止加载程序集。
  • ExecuteMenuItem
    Invokes the menu item in the specified path.
       调用指定路径的菜单项。
  • UnlockReloadAssemblies
    Must be called after LockReloadAssemblies, to reenable loading of assemblies.
       必须在LockReloadAssemblies之后调用,用来重新激活加载程序集。
  • Exit
    Exit the Unity editor application.
       退出Unity编辑器程序。
  • RepaintProjectWindow
    Can be used to ensure repaint of the ProjectWindow.
       可以用来确保项目窗口重绘。
  • RepaintHierarchyWindow
    Can be used to ensure repaint of the HierarchyWindow.
       可用来确保层级窗口重绘。
  • Beep
    Plays system beep sound. // 播放系统鸣叫。

Delegates委托

  • ProjectWindowItemCallback
    Delegate to be called for every visible list item in the ProjectWindow on every OnGUI event.
       委托调用用于在ProjectWindow每个OnGUI事件上每个可见列表项。
  • HierarchyWindowItemCallback
    Delegate to be called for every visible list item in the HierarchyWindow on every OnGUI event.
       委托调用用于在HierarchyWindow每个OnGUI事件上每个可见列表项。
  • CallbackFunction
    Delegate to be called from EditorApplication callbacks.
       委托需从EditorApplication回调调用。


,