Godot 场景树及常见调用顺序
Godot场景树func调用顺序
-Root
-Child1
-GrandChild1
-Child2
后面接的数字代表当时子节点数
init时不能获取name
init0
init0
init0
init0
Root enter tree!2
Child1 enter tree!1
GrandChild1 enter tree!0
Child2 enter tree!0
GrandChild1 ready!0
Child1 ready!1
Child2 ready!0
Root ready!2
Child2 exit tree!0
GrandChild1 exit tree!0
Child1 exit tree!1
Root exit tree!2
_ready函数
_enter_tree函数
添加子节点
从场景树移除节点
场景树函数的启用
node.set_process(!pause)
node.set_process_input(!pause)
node.set_process_internal(!pause)
node.set_process_unhandled_input(!pause)
node.set_process_unhandled_key_input(!pause)
node.set_physics_process(!pause)
node.set_physics_process_internal(!pause)
toolmode
tool mode下只切换编辑场景触发_enter_tree,编辑器首次打开场景执行_ready
tool mode下_input不能正常触发 Input function does not run in tool scripts · Issue #20319 · godotengine/godot (github.com) ,必须使用plugin,或配合plugin editor panel使用
toolscript的enter_tree, exit_tree, _process等可以正常使用
Comments
Post a Comment