Topic was automatically imported from the old Question2Answer platform.
Asked By
roma
Is it possible to use the following method to save the game (I know it will be very slow): save the current scene to a .tscn file, and then change the main scene to this scene?
What following method?
SteveSmith | 2023-01-14 15:16
My method:save the current scene to a .tscn file, and then change the main scene to this scene. I can do this in Godot 3.5.1?
If I’ve understood correctly, you might be looking for the ResourceSaver
It will save any Resource as a tscn file, which should include Scenes I think.
Switching scenes is done with the SceneTree class. it might be what you’re looking for.
But it might be better to save the state of each thing in a scene instead and then you can load the savegame back later re-spawning everything using the saved data.
Відповідь на це питтання є. Треба написати функцію яка буде збирати всі потрібні дані з об’єктів, зберегти в файл SAVE/DAT, а потім завантажити це. Це є в стандартному підручнику Godot про зберігання ігор.