File tree Expand file tree Collapse file tree 1 file changed +26
-1
lines changed Expand file tree Collapse file tree 1 file changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -432,7 +432,8 @@ an autoload.
432432
433433Use the following code to register a singleton from an editor plugin:
434434
435- ::
435+ .. tabs ::
436+ .. code-tab :: gdscript GDScript
436437
437438 @tool
438439 extends EditorPlugin
@@ -448,3 +449,27 @@ Use the following code to register a singleton from an editor plugin:
448449
449450 func _exit_tree():
450451 remove_autoload_singleton(AUTOLOAD_NAME)
452+
453+ .. code-tab :: csharp
454+
455+ #if TOOLS
456+ using Godot;
457+
458+ [Tool]
459+ public partial class MyEditorPlugin : EditorPlugin
460+ {
461+ // Replace this value with a PascalCase autoload name.
462+ private const string AutoloadName = "SomeAutoload";
463+
464+ public override void _EnterTree()
465+ {
466+ // The autoload can be a scene or script file.
467+ AddAutoloadSingleton(AutoloadName, "res://addons/MyAddon/SomeAutoload.tscn");
468+ }
469+
470+ public override void _ExitTree()
471+ {
472+ RemoveAutoloadSingleton(AutoloadName);
473+ }
474+ }
475+ #endif
You can’t perform that action at this time.
0 commit comments