Skip to content

Commit

Permalink
Merge pull request #9979 from godotengine/Hilderin-documentation_add_…
Browse files Browse the repository at this point in the history
…autoload_singleton_in_plugin

Fix code sample for add_autoload_singleton in plugin
  • Loading branch information
mhilbrunner authored Oct 5, 2024
2 parents 5cf5f7c + 69d0d47 commit e78f537
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tutorials/plugins/editor/making_plugins.rst
Original file line number Diff line number Diff line change
Expand Up @@ -450,12 +450,12 @@ Use the following code to register a singleton from an editor plugin:
const AUTOLOAD_NAME = "SomeAutoload"


func _enter_tree():
func _enable_plugin():
# The autoload can be a scene or script file.
add_autoload_singleton(AUTOLOAD_NAME, "res://addons/my_addon/some_autoload.tscn")


func _exit_tree():
func _disable_plugin():
remove_autoload_singleton(AUTOLOAD_NAME)

.. code-tab:: csharp
Expand All @@ -469,13 +469,13 @@ Use the following code to register a singleton from an editor plugin:
// Replace this value with a PascalCase autoload name.
private const string AutoloadName = "SomeAutoload";

public override void _EnterTree()
public override void _EnablePlugin()
{
// The autoload can be a scene or script file.
AddAutoloadSingleton(AutoloadName, "res://addons/MyAddon/SomeAutoload.tscn");
}

public override void _ExitTree()
public override void _DisablePlugin()
{
RemoveAutoloadSingleton(AutoloadName);
}
Expand Down

0 comments on commit e78f537

Please sign in to comment.