summaryrefslogtreecommitdiff
path: root/doc/classes/Object.xml
diff options
context:
space:
mode:
authorRaul Santos <raulsntos@gmail.com>2023-01-31 18:21:09 +0100
committerRaul Santos <raulsntos@gmail.com>2023-01-31 19:04:07 +0100
commit7eb832518081f15477150c561d6767fe35d17221 (patch)
treee13d1d0502d6290571daf441d41e1449e0c5f232 /doc/classes/Object.xml
parent8612c12be61c0bc50d9039402fe19cabadfe0b16 (diff)
Fix C# examples in documentation
- Fix documentation after C# renames. - Add missing `partial` in C# class declarations. - Change `delta` parameter type to `double` in C#. - Ensure parameters match base declaration. - Use `$` string interpolation in C#. - Fix invalid or outdated C# code. - Changed some examples to follow our style guide more closely.
Diffstat (limited to 'doc/classes/Object.xml')
-rw-r--r--doc/classes/Object.xml20
1 files changed, 10 insertions, 10 deletions
diff --git a/doc/classes/Object.xml b/doc/classes/Object.xml
index e4607456ca..e30ff6be19 100644
--- a/doc/classes/Object.xml
+++ b/doc/classes/Object.xml
@@ -110,7 +110,7 @@
[/gdscript]
[csharp]
[Tool]
- public class MyNode2D : Node2D
+ public partial class MyNode2D : Node2D
{
private bool _holdingHammer;
@@ -433,9 +433,9 @@
var button = new Button();
// Option 1: In C#, we can use signals as events and connect with this idiomatic syntax:
button.ButtonDown += OnButtonDown;
- // Option 2: Object.Connect() with a constructed Callable from a method group.
+ // Option 2: GodotObject.Connect() with a constructed Callable from a method group.
button.Connect(Button.SignalName.ButtonDown, Callable.From(OnButtonDown));
- // Option 3: Object.Connect() with a constructed Callable using a target object and method name.
+ // Option 3: GodotObject.Connect() with a constructed Callable using a target object and method name.
button.Connect(Button.SignalName.ButtonDown, new Callable(this, MethodName.OnButtonDown));
}
@@ -700,10 +700,10 @@
sprite2d.is_class("Node3D") # Returns false
[/gdscript]
[csharp]
- var sprite2d = new Sprite2D();
- sprite2d.IsClass("Sprite2D"); // Returns true
- sprite2d.IsClass("Node"); // Returns true
- sprite2d.IsClass("Node3D"); // Returns false
+ var sprite2D = new Sprite2D();
+ sprite2D.IsClass("Sprite2D"); // Returns true
+ sprite2D.IsClass("Node"); // Returns true
+ sprite2D.IsClass("Node3D"); // Returns false
[/csharp]
[/codeblocks]
[b]Note:[/b] This method ignores [code]class_name[/code] declarations in the object's script.
@@ -747,10 +747,10 @@
player.SetScript(GD.Load("res://player.gd"));
player.Notification(NotificationEnterTree);
- // The call order is Object -&gt; Node -&gt; Node2D -&gt; player.gd.
+ // The call order is GodotObject -&gt; Node -&gt; Node2D -&gt; player.gd.
- player.notification(NotificationEnterTree, true);
- // The call order is player.gd -&gt; Node2D -&gt; Node -&gt; Object.
+ player.Notification(NotificationEnterTree, true);
+ // The call order is player.gd -&gt; Node2D -&gt; Node -&gt; GodotObject.
[/csharp]
[/codeblocks]
</description>