+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 (679 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,694 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)


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.

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,694 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 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 webmaster@godotengine.org with your username.