diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2024-03-07 15:24:04 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2024-03-07 15:24:04 +0100 |
commit | aef11a14274f6f9e74ad91ead1d7c07ea1dd7f5f (patch) | |
tree | 26231b2b8ec766b76ef7ac4b06001bbe67c0d0e0 | |
parent | dd90c3c30c0f94682141a9ac1bd6f53f8a5d5c56 (diff) | |
parent | 2f1f8ee39b53798a070954a68df0996916193dff (diff) | |
download | redot-engine-aef11a14274f6f9e74ad91ead1d7c07ea1dd7f5f.tar.gz |
Merge pull request #89246 from AThousandShips/dotnet_name
[Docs][C#] Use `PropertyName` constants in more places
-rw-r--r-- | doc/classes/Object.xml | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/doc/classes/Object.xml b/doc/classes/Object.xml index 724c9a38d8..065b75382d 100644 --- a/doc/classes/Object.xml +++ b/doc/classes/Object.xml @@ -643,7 +643,7 @@ [csharp] var node = new Node2D(); node.Rotation = 1.5f; - var a = node.Get("rotation"); // a is 1.5 + var a = node.Get(Node2D.PropertyName.Rotation); // a is 1.5 [/csharp] [/codeblocks] [b]Note:[/b] In C#, [param property] must be in snake_case when referring to built-in Godot properties. Prefer using the names exposed in the [code]PropertyName[/code] class to avoid allocating a new [StringName] on each call. @@ -911,7 +911,7 @@ [/gdscript] [csharp] var node = new Node2D(); - node.Set("global_scale", new Vector2(8, 2.5)); + node.Set(Node2D.PropertyName.GlobalScale, new Vector2(8, 2.5)); GD.Print(node.GlobalScale); // Prints Vector2(8, 2.5) [/csharp] [/codeblocks] @@ -936,21 +936,21 @@ var node = Node2D.new() add_child(node) - node.rotation = 45.0 - node.set_deferred("rotation", 90.0) - print(node.rotation) # Prints 45.0 + node.rotation = 1.5 + node.set_deferred("rotation", 3.0) + print(node.rotation) # Prints 1.5 await get_tree().process_frame - print(node.rotation) # Prints 90.0 + print(node.rotation) # Prints 3.0 [/gdscript] [csharp] var node = new Node2D(); - node.Rotation = 45f; - node.SetDeferred("rotation", 90f); - GD.Print(node.Rotation); // Prints 45.0 + node.Rotation = 1.5f; + node.SetDeferred(Node2D.PropertyName.Rotation, 3f); + GD.Print(node.Rotation); // Prints 1.5 await ToSignal(GetTree(), SceneTree.SignalName.ProcessFrame); - GD.Print(node.Rotation); // Prints 90.0 + GD.Print(node.Rotation); // Prints 3.0 [/csharp] [/codeblocks] [b]Note:[/b] In C#, [param property] must be in snake_case when referring to built-in Godot properties. Prefer using the names exposed in the [code]PropertyName[/code] class to avoid allocating a new [StringName] on each call. |