Browse Source

Fix wrong C# code examples in making plugins tutorial

Mateus Elias 1 year ago
parent
commit
e77e9e8877
1 changed files with 8 additions and 8 deletions
  1. 8 8
      tutorials/plugins/editor/making_plugins.rst

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

@@ -58,7 +58,7 @@ To continue with the example, use the following values:
  .. code-tab:: ini C#
  .. code-tab:: ini C#
 
 
     Plugin Name: My Custom Node
     Plugin Name: My Custom Node
-    Subfolder: my_custom_node
+    Subfolder: MyCustomNode
     Description: A custom node made to extend the Godot Engine.
     Description: A custom node made to extend the Godot Engine.
     Author: Your Name Here
     Author: Your Name Here
     Version: 1.0.0
     Version: 1.0.0
@@ -246,8 +246,8 @@ dialog. For that, change the ``custom_node.gd`` script to the following:
         {
         {
             // Initialization of the plugin goes here.
             // Initialization of the plugin goes here.
             // Add the new type with a name, a parent type, a script and an icon.
             // Add the new type with a name, a parent type, a script and an icon.
-            var script = GD.Load<Script>("res://addons/my_custom_node/MyButton.cs");
-            var texture = GD.Load<Texture2D>("res://addons/my_custom_node/icon.png");
+            var script = GD.Load<Script>("res://addons/MyCustomNode/MyButton.cs");
+            var texture = GD.Load<Texture2D>("res://addons/MyCustomNode/Icon.png");
             AddCustomType("MyButton", "Button", script, texture);
             AddCustomType("MyButton", "Button", script, texture);
         }
         }
 
 
@@ -367,21 +367,21 @@ The script could look like this:
     [Tool]
     [Tool]
     public partial class CustomDock : EditorPlugin
     public partial class CustomDock : EditorPlugin
     {
     {
-        Control dock;
+        private Control _dock;
 
 
         public override void _EnterTree()
         public override void _EnterTree()
         {
         {
-            dock = (Control)GD.Load<PackedScene>("addons/my_custom_dock/my_dock.tscn").Instantiate();
-            AddControlToDock(DockSlot.LeftUl, dock);
+            _dock = GD.Load<PackedScene>("res://addons/MyCustomDock/MyDock.tscn").Instantiate<Control>();
+            AddControlToDock(DockSlot.LeftUl, _dock);
         }
         }
 
 
         public override void _ExitTree()
         public override void _ExitTree()
         {
         {
             // Clean-up of the plugin goes here.
             // Clean-up of the plugin goes here.
             // Remove the dock.
             // Remove the dock.
-            RemoveControlFromDocks(dock);
+            RemoveControlFromDocks(_dock);
             // Erase the control from the memory.
             // Erase the control from the memory.
-            dock.Free();
+            _dock.Free();
         }
         }
     }
     }
     #endif
     #endif