How does the method change_scene_to_file exactly work? Which current scene does it exactly replaces with the given file?
If this is what my remote tree looks like, I’ve always found it changing the Game node with the given file even when the children scenes call the method.
And how do I change a specific node with another scene? e.g. in the following image, if I want to change the GameTimer scene with something else, how do I do so?
Use owner to get the root of this scene (this scene here stands for the instantiated scene file), and you can only have one scene (this scene here stands for the current game scene).
For instance, I have a player scene, in which there is a timer node. If I write @onready var player = owner in the timer’s script, the player property will be the root node of the player scene.
On one hand, games have a “scene” that contains all current things, this is what the change_scene_to_file() stands for. On the other hand, a scene is a node tree, stored as a file in Godot and can be instantiated to be used.