Hi, i just have a question, you see, i was searching on internet, ways to change the scenes in a game.
And i saw two ways, one using an autoload or singleton, and the other one, having a main scene, and add a child and remove it when is needed it (to save the data between the scenes).
But, im confused, i have two nodes, one that is the “manager” from the scenes, and another one that is the main menu of the game, where the game starts, how can i detect when i press the start button on the main menu scene, and remove the child in the “manager”, im doing this correctly?, or there is better way?
Use get_parent() to get the Manager and call the method you’re using to change scene or use groups, add the manager node to a group called “manager” and use get_tree().call_group("manager", "the_func_that_change_scene").
Oh yeah i saw that, but a question, that will erase all the data inside of the scene right?, because you are changing the root node, and removing the old scene, i mean destroying it, right?
Correct, your data stored on the scene will be lost.
If you need to persist any data between the scene changes (like player stats for example), just put that data in the Autoload variables, or even consider saving it to a JSON file.