Version: 2022.3

CodeEditor

class in Unity.CodeEditor

切换到手册

描述

使用代码编辑器处理交互。

静态变量

CurrentEditorPathThe path to the external code editor that Unity uses used to open script assets.
EditorA singleton instance of CodeEditor. The Unity Editor references this instance to handle code editor callbacks.

变量

CurrentCodeEditorReturns the current IExternalCodeEditor instance for the code editor.
CurrentInstallationReturns the current CodeEditor.Installation instance for the code editor.

公共函数

GetCodeEditorForPathEach registered code editor package has an instance of IExternalCodeEditor. This method invokes IExternalCodeEditor.TryGetInstallationForPath on that instance. It returns the first instance that returns a valid installation.
GetFoundScriptEditorPathsCollects all installations from registered instances of IExternalCodeEditor. This is done using IExternalCodeEditor.Installations.
GetInstallationForPathEach registered code editor package has an instance of IExternalCodeEditor. This method invokes IExternalCodeEditor.TryGetInstallationForPath on that instance. It finds the first instance that returns a valid installation, and returns the installation.
SetCodeEditorSets the path to the code editor that Unity uses to open script assets.

静态函数

OSOpenFile使用引号引起来的参数字符串打开应用程序。
ParseArgument使用 External Tools 下面定义的规则分析字符串。
QuoteForProcessStartQuotes a string to pass to Process.Start as a single argument, and appends it to this string builder.
Register注册在填充 Preferences/External Tools 菜单时要使用的 IExternalCodeEditor 的实例。如果选择该实例,则调用 ref::Initialize。
Unregister从注册代码编辑器列表中删除 IExternalCodeEditor 实例。如果选择该实例,则调用 ref::Initialize。