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>

GotoHelp(string)

Opens help for the given topic. The topic is an encoded string that controls which class, method, constant, signal, annotation, property, or theme item should be focused.

The supported topic formats include class_name:class, class_method:class:method, class_constant:class:constant, class_signal:class:signal, class_annotation:class:@annotation, class_property:class:property, and class_theme_item:class:item, where class is the class name, method is the method name, constant is the constant name, signal is the signal name, annotation is the annotation name, property is the property name, and item is the theme item.

Examples:

# Shows help for the Node class.
  class_name:Node
  # Shows help for the global min function.
  # Global objects are accessible in the `@GlobalScope` namespace, shown here.
  class_method:@GlobalScope:min
  # Shows help for get_viewport in the Node class.
  class_method:Node:get_viewport
  # Shows help for the Input constant MOUSE_BUTTON_MIDDLE.
  class_constant:Input:MOUSE_BUTTON_MIDDLE
  # Shows help for the BaseButton signal pressed.
  class_signal:BaseButton:pressed
  # Shows help for the CanvasItem property visible.
  class_property:CanvasItem:visible
  # Shows help for the GDScript annotation export.
  # Annotations should be prefixed with the `@` symbol in the descriptor, as shown here.
  class_annotation:@GDScript:@export
  # Shows help for the GraphNode theme item named panel_selected.
  class_theme_item:GraphNode:panel_selected
public void GotoHelp(string topic)

Parameters

topic string

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