ScriptEditor
The panel for open internal documents and built-in help.
Obtain the instance through EditorInterface.Singleton.GetScriptEditor(). Open documents, an active Script resource and a help tab are different concepts: help is not Script/ScriptEditorBase. GetCurrentScript() and GetCurrentEditor() can return null.
GetOpenScripts() and GetUnsavedFiles() concern internal documents, not the entire project or external IDE buffers. C# project context, compilation and debugging are configured separately.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Methods16
ClearDocsFromScriptvoid
public void ClearDocsFromScript(Script script);Removes the documentation for the given script.
Note: This should be called whenever the script is changed to keep the open documentation state up to date.
| Name | Type | Default |
|---|---|---|
script | Script | — |
CloseFileError
public Error CloseFile(string path);Closes the file at the given path, discarding any unsaved changes.
Returns OK on success or ERR_FILE_NOT_FOUND if the file is not found.
| Name | Type | Default |
|---|---|---|
path | string | — |
ErrorGetBreakpointsstring[]
public string[] GetBreakpoints();Returns array of breakpoints.
string[]GetCurrentEditorScriptEditorBase
public ScriptEditorBase GetCurrentEditor();Return the current ScriptEditorBase when the active document has that type. A help tab does not, so null is valid. This does not retrieve an external editor process.
ScriptEditorBaseThe current ScriptEditorBase, or null.
GetCurrentScriptScript
public Script GetCurrentScript();Return the active internal editor Script. Help tabs or the absence of a suitable document return null. This does not determine the active file in an external C# IDE.
ScriptThe Script resource, or null.
GetOpenScriptEditorsReckfell.Collections.Array<ScriptEditorBase>
public Reckfell.Collections.Array<ScriptEditorBase> GetOpenScriptEditors();Returns an array with all ScriptEditorBase objects which are currently open in editor.
Reckfell.Collections.Array<ScriptEditorBase>GetOpenScriptsReckfell.Collections.Array<Script>
public Reckfell.Collections.Array<Script> GetOpenScripts();List Script resources open in internal documents. Help and arbitrary text files do not become scripts; this is not an index of all project files or external IDE documents.
Reckfell.Collections.Array<Script>An array of open Script resources.
GetUnsavedFilesstring[]
public string[] GetUnsavedFiles();List internal document paths with unsaved buffers. This excludes unsaved external IDE text and does not establish that an entire scene or project is saved.
string[]Paths of documents the internal editor considers unsaved.
GotoHelpvoid
public void GotoHelp(string topic);Open built-in help using a descriptor such as class_name:Entity. This neither opens a Script nor chooses an external C# IDE; GetCurrentScript() can return null afterward.
| Name | Type | Default |
|---|---|---|
topic | string | — |
topicThe help topic descriptor; class_name:Entity is the verified example.
GotoLinevoid
public void GotoLine(int lineNumber);Goes to the specified line in the current script.
| Name | Type | Default |
|---|---|---|
lineNumber | int | — |
OpenScriptCreateDialogvoid
public void OpenScriptCreateDialog(string baseName, string basePath);Opens the script create dialog. The script will extend base_name. The file extension can be omitted from base_path. It will be added based on the selected scripting language.
| Name | Type | Default |
|---|---|---|
baseName | string | — |
basePath | string | — |
RegisterSyntaxHighlightervoid
public void RegisterSyntaxHighlighter(EditorSyntaxHighlighter syntaxHighlighter);Registers the EditorSyntaxHighlighter to the editor, the EditorSyntaxHighlighter will be available on all open scripts.
Note: Does not apply to scripts that are already opened.
| Name | Type | Default |
|---|---|---|
syntaxHighlighter | EditorSyntaxHighlighter | — |
ReloadOpenFilesvoid
public void ReloadOpenFiles();Reloads all currently opened files. This should be used when opened files are changed outside of the script editor. The user may be prompted to resolve file conflicts, see EditorSettings.text_editor/behavior/files/auto_reload_scripts_on_external_change.
SaveAllScriptsvoid
public void SaveAllScripts();Saves all open scripts.
UnregisterSyntaxHighlightervoid
public void UnregisterSyntaxHighlighter(EditorSyntaxHighlighter syntaxHighlighter);Unregisters the EditorSyntaxHighlighter from the editor.
Note: The EditorSyntaxHighlighter will still be applied to scripts that are already opened.
| Name | Type | Default |
|---|---|---|
syntaxHighlighter | EditorSyntaxHighlighter | — |
UpdateDocsFromScriptvoid
public void UpdateDocsFromScript(Script script);Updates the documentation for the given script.
Note: This should be called whenever the script is changed to keep the open documentation state up to date.
| Name | Type | Default |
|---|---|---|
script | Script | — |
Signals and events2
EditorScriptChangedEvent
public event ScriptEditor.EditorScriptChangedEventHandler EditorScriptChanged;Emitted when user changed active script. Argument is a freshly activated Script.
| Name | Type | Default |
|---|---|---|
script | Script | — |
ScriptCloseEvent
public event ScriptEditor.ScriptCloseEventHandler ScriptClose;Emitted when editor is about to close the active script. Argument is a Script that is going to be closed.
| Name | Type | Default |
|---|---|---|
script | Script | — |