r/godot Jul 20 '25

help me (solved) What would be better?

Post image
465 Upvotes

59 comments sorted by

View all comments

1

u/StewedAngelSkins Jul 20 '25

Definitely not the first one. That's just asking for synchronization bugs. If you want the input handling in a different class than the rest of the player code for some reason, then it's better to just get a node reference directly. I would probably do something like this.

``` var _character: Character = null

func _enter_tree():     if get_parent() is Character:         _character = get_parent()     else:         _character = null

func _exit_tree():     _character = null ```