How can I assign a variable as a function to another scene??

Godot Version

4

Question

How can I assign a variable in a different scene as a function to another scene to detect that it has changed?

Are both scenes loaded at the same time? If no then you might want to use autoloads/singletons. If yes you would need a reference to this scene. you can use the @export functionality or the parent node of the scenes or also an autoload/singleton

1 Like

If it’s a basic variable you can create a global variable - that way all of your code can read and adjust it.

My global.gd contains things like score and player_last_position.

If you need code examples, let me know. :smile: