Răsfoiți Sursa

Fix code sample for add_autoload_singleton in plugin

- Add documentation for issue https://github.com/godotengine/godot/issues/68285
Hilderin 10 luni în urmă
părinte
comite
d8039bd436
1 a modificat fișierele cu 4 adăugiri și 4 ștergeri
  1. 4 4
      tutorials/plugins/editor/making_plugins.rst

+ 4 - 4
tutorials/plugins/editor/making_plugins.rst

@@ -450,12 +450,12 @@ Use the following code to register a singleton from an editor plugin:
     const AUTOLOAD_NAME = "SomeAutoload"
     const AUTOLOAD_NAME = "SomeAutoload"
 
 
 
 
-    func _enter_tree():
+    func _enable_plugin():
         # The autoload can be a scene or script file.
         # The autoload can be a scene or script file.
         add_autoload_singleton(AUTOLOAD_NAME, "res://addons/my_addon/some_autoload.tscn")
         add_autoload_singleton(AUTOLOAD_NAME, "res://addons/my_addon/some_autoload.tscn")
 
 
 
 
-    func _exit_tree():
+    func _disable_plugin():
         remove_autoload_singleton(AUTOLOAD_NAME)
         remove_autoload_singleton(AUTOLOAD_NAME)
 
 
  .. code-tab:: csharp
  .. code-tab:: csharp
@@ -469,13 +469,13 @@ Use the following code to register a singleton from an editor plugin:
         // Replace this value with a PascalCase autoload name.
         // Replace this value with a PascalCase autoload name.
         private const string AutoloadName = "SomeAutoload";
         private const string AutoloadName = "SomeAutoload";
 
 
-        public override void _EnterTree()
+        public override void _EnablePlugin()
         {
         {
             // The autoload can be a scene or script file.
             // The autoload can be a scene or script file.
             AddAutoloadSingleton(AutoloadName, "res://addons/MyAddon/SomeAutoload.tscn");
             AddAutoloadSingleton(AutoloadName, "res://addons/MyAddon/SomeAutoload.tscn");
         }
         }
 
 
-        public override void _ExitTree()
+        public override void _DisablePlugin()
         {
         {
             RemoveAutoloadSingleton(AutoloadName);
             RemoveAutoloadSingleton(AutoloadName);
         }
         }