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.
This commit is contained in:
@ -10,12 +10,14 @@
|
||||
[gdscript]
|
||||
@tool # Needed so it runs in editor.
|
||||
extends EditorScenePostImport
|
||||
|
||||
# This sample changes all node names.
|
||||
# Called right after the scene is imported and gets the root node.
|
||||
func _post_import(scene):
|
||||
# Change all node names to "modified_[oldnodename]"
|
||||
iterate(scene)
|
||||
return scene # Remember to return the imported scene
|
||||
|
||||
func iterate(node):
|
||||
if node != null:
|
||||
node.name = "modified_" + node.name
|
||||
@ -30,17 +32,18 @@
|
||||
[Tool]
|
||||
public partial class NodeRenamer : EditorScenePostImport
|
||||
{
|
||||
public override Object _PostImport(Node scene)
|
||||
public override GodotObject _PostImport(Node scene)
|
||||
{
|
||||
// Change all node names to "modified_[oldnodename]"
|
||||
Iterate(scene);
|
||||
return scene; // Remember to return the imported scene
|
||||
}
|
||||
|
||||
public void Iterate(Node node)
|
||||
{
|
||||
if (node != null)
|
||||
{
|
||||
node.Name = "modified_" + node.Name;
|
||||
node.Name = $"modified_{node.Name}";
|
||||
foreach (Node child in node.GetChildren())
|
||||
{
|
||||
Iterate(child);
|
||||
|
||||
Reference in New Issue
Block a user