瀏覽代碼

rework two funcref code examples (#6542)

Co-authored-by: Max Hilbrunner <[email protected]>
matt08-prog 2 年之前
父節點
當前提交
88e02928f3
共有 2 個文件被更改,包括 4 次插入4 次删除
  1. 2 2
      tutorials/best_practices/godot_interfaces.rst
  2. 2 2
      tutorials/best_practices/scene_organization.rst

+ 2 - 2
tutorials/best_practices/godot_interfaces.rst

@@ -478,7 +478,7 @@ accesses:
 
     func my_method():
         if fn:
-            fn.call_func()
+            fn.call()
 
     # parent.gd
     extends Node
@@ -486,7 +486,7 @@ accesses:
     @onready var child = $Child
 
     func _ready():
-        child.fn = funcref(self, "print_me")
+        child.fn = print_me
         child.my_method()
 
     func print_me():

+ 2 - 2
tutorials/best_practices/scene_organization.rst

@@ -98,10 +98,10 @@ initialize it:
      .. code-tab:: gdscript GDScript
 
        # Parent
-       $Child.func_property = funcref(object_with_method, "method_on_the_object")
+       $Child.func_property = object_with_method.method_on_the_object
 
        # Child
-       func_property.call_func() # Call parent-defined method (can come from anywhere).
+       func_property.call() # Call parent-defined method (can come from anywhere).
 
      .. code-tab:: csharp