Table of Contents

Class ScriptEditor

Namespace
Godot
Assembly
GodotSharpEditor.dll

Godot editor's script editor.

Note: This class shouldn't be instantiated directly. Instead, access the singleton using GetScriptEditor().

public class ScriptEditor : PanelContainer, IDisposable
Inheritance
ScriptEditor
Implements
Inherited Members

Methods

GetCurrentEditor()

Returns the ScriptEditorBase object that the user is currently editing.

public ScriptEditorBase GetCurrentEditor()

Returns

ScriptEditorBase

GetCurrentScript()

Returns a Script that is currently active in editor.

public Script GetCurrentScript()

Returns

Script

GetOpenScriptEditors()

Returns an array with all ScriptEditorBase objects which are currently open in editor.

public Array<ScriptEditorBase> GetOpenScriptEditors()

Returns

Array<ScriptEditorBase>

GetOpenScripts()

Returns an array with all Script objects which are currently open in editor.

public Array<Script> GetOpenScripts()

Returns

Array<Script>

GotoLine(int)

Goes to the specified line in the current script.

public void GotoLine(int lineNumber)

Parameters

lineNumber int

HasGodotClassMethod(in godot_string_name)

Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.

protected override bool HasGodotClassMethod(in godot_string_name method)

Parameters

method godot_string_name

Name of the method to check for.

Returns

bool

HasGodotClassSignal(in godot_string_name)

Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.

protected override bool HasGodotClassSignal(in godot_string_name signal)

Parameters

signal godot_string_name

Name of the signal to check for.

Returns

bool

InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)

Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.

protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)

Parameters

method godot_string_name

Name of the method to invoke.

args NativeVariantPtrArgs

Arguments to use with the invoked method.

ret godot_variant

Value returned by the invoked method.

Returns

bool

OpenScriptCreateDialog(string, string)

Opens the script create dialog. The script will extend baseName. The file extension can be omitted from basePath. It will be added based on the selected scripting language.

public void OpenScriptCreateDialog(string baseName, string basePath)

Parameters

baseName string
basePath string

RegisterSyntaxHighlighter(EditorSyntaxHighlighter)

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.

public void RegisterSyntaxHighlighter(EditorSyntaxHighlighter syntaxHighlighter)

Parameters

syntaxHighlighter EditorSyntaxHighlighter

UnregisterSyntaxHighlighter(EditorSyntaxHighlighter)

Unregisters the EditorSyntaxHighlighter from the editor.

Note: The EditorSyntaxHighlighter will still be applied to scripts that are already opened.

public void UnregisterSyntaxHighlighter(EditorSyntaxHighlighter syntaxHighlighter)

Parameters

syntaxHighlighter EditorSyntaxHighlighter

Events

EditorScriptChanged

Emitted when user changed active script. Argument is a freshly activated Script.

public event ScriptEditor.EditorScriptChangedEventHandler EditorScriptChanged

Event Type

ScriptEditor.EditorScriptChangedEventHandler

ScriptClose

Emitted when editor is about to close the active script. Argument is a Script that is going to be closed.

public event ScriptEditor.ScriptCloseEventHandler ScriptClose

Event Type

ScriptEditor.ScriptCloseEventHandler