Browse Source

Fixed C# file-path strings for example plugin resources

The example (tutorial) plugin resides in an addons/my_custom_node
subdirectory of its project. The C# example code uses the same
relative path structure for a custom script and icon as the
GDScript example. These paths cause errors when the user activates
the plugin, as Godot looks for the resources in the root directory
of the project. This change fixes the errors by using the fully
qualified "res://" path to the resources in the C# example code.
Mark Wilson 2 years ago
parent
commit
93922aaa8c
1 changed files with 2 additions and 2 deletions
  1. 2 2
      tutorials/plugins/editor/making_plugins.rst

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

@@ -246,8 +246,8 @@ dialog. For that, change the ``custom_node.gd`` script to the following:
         {
             // Initialization of the plugin goes here.
             // Add the new type with a name, a parent type, a script and an icon.
-            var script = GD.Load<Script>("MyButton.cs");
-            var texture = GD.Load<Texture2D>("icon.png");
+            var script = GD.Load<Script>("res://addons/my_custom_node/MyButton.cs");
+            var texture = GD.Load<Texture2D>("res://addons/my_custom_node/icon.png");
             AddCustomType("MyButton", "Button", script, texture);
         }