What's the best way to transfer information from a node to another one?

Godot Version

4.3

Question

I’m working on a project in Godot, and I need to transfer data between nodes that are in different scenes (or different trees of nodes). Specifically, I need to pass or share information (such as variables or settings) between nodes that do not belong to the same scene tree.

You can use autoloads for that.

You can check the Best practices section in the documentation for more information about how to structure your scenes and pass information around.

1 Like

You can also detatch a node from the scene tree using remove_child() and then reattach it to another scene using add_child(). This is useful for more complex objects like the player object.

1 Like

I’ll check it out, really appreciate the tip!

Got it! I’ll give it a shot, thanks!

1 Like