From 47427a526cbbc0be81e83f5291c8bed935946031 Mon Sep 17 00:00:00 2001 From: j4d3blooded <94726557+j4d3blooded@users.noreply.github.com> Date: Tue, 30 Apr 2024 03:16:52 +0100 Subject: [PATCH] Update Resources tutorial to mention and use the GlobalClass annotation for C# (#9278) * Updated Resources tutorial to mention and use the GlobalClass annotation for C# The previous version of this page didn't mention using the `[GlobalClass]` annotation. Following this tutorial results in the user not finding their resource in the Create a new resource menu without any understanding as to why --------- Co-authored-by: Paul Joannon <437025+paulloz@users.noreply.github.com> Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com> --- tutorials/scripting/resources.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tutorials/scripting/resources.rst b/tutorials/scripting/resources.rst index db51713c1..2829994cd 100644 --- a/tutorials/scripting/resources.rst +++ b/tutorials/scripting/resources.rst @@ -208,6 +208,9 @@ It should appear in your file tab with the full name ``bot_stats.tres``. Without a script, it's useless, so let's add some data and logic! Attach a script to it named ``bot_stats.gd`` (or just create a new script, and then drag it to it). +.. note:: + If you're using C#, you need to annotate your Resource class with the ``[GlobalClass]`` attribute for it to show up in the create resource GUI. + .. tabs:: .. code-tab:: gdscript GDScript @@ -232,6 +235,7 @@ Attach a script to it named ``bot_stats.gd`` (or just create a new script, and t namespace ExampleProject { + [GlobalClass] public partial class BotStats : Resource { [Export] @@ -330,6 +334,7 @@ Now, select the :ref:`CharacterBody3D ` node which we nam using Godot; + [GlobalClass] public partial class BotStatsTable : Resource { private Godot.Dictionary _stats = new Godot.Dictionary(); @@ -384,6 +389,7 @@ Now, select the :ref:`CharacterBody3D ` node which we nam public partial class MyNode : Node { + [GlobalClass] public partial class MyResource : Resource { [Export]