This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
+1 vote

According to the Node.set_owner() documentation:

When saving a node (using SceneSaver) all the nodes it owns will be saved with it

Does SceneSaver exists or should we use the method the documentation explains to load and save games?

in Engine by (692 points)

Looks like SceneSaver is now ResourceSaver...

2 Answers

+4 votes
Best answer

After a few test, I found a way to save a node to scn

var scene = PackedScene.new()
var result = scene.pack(child)
if result == OK:
    ResourceSaver.save("res://path/name.scn", scene) // or user://...

I think this will save current node status to scn file,
and probably reconstruct all when load.

by (9,800 points)
selected by

Yes :)
This is what I used a while ago to generate a lot of sprite nodes out of a tilesheet.

Interesting. PackedScene documentation brings to other new resource to me: SceneState which shows when reading his members what's saved with he scene:

  • Nodes count
  • Node type, name, path by node index
  • Whether node is a placeholder and its instance
  • Nodes groups
  • Nodes properties
  • Nodes connections and signals (methods and flags)

Fantastic!

and the "res://path/name.scn", scene) // or user:// is loaded when you load your game? or how does it works?

0 votes

SceneSaver seems no longer exists.
To load and save game, it's better to follow that instruction as you said.
http://docs.godotengine.org/en/latest/tutorials/engine/saving_games.html

I don't know what you really want for saving game,
you can also use File.get_var() / File.store_var() for loading and saving game data.

by (9,800 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.