0 votes

I'm writing Godot tool for editing enemies in my game. Node approach seems to be the best option (and better than my actual table editing).

First part works flawlessly (saving values to arrays) but I have problem: how can I save GraphEdit for latter editing? Should I make it from scratch saving all nodes with offsets, values etc. to some file or there is some more convenient and simple method for that?

in Engine by (227 points)

can any one can give a demo?

1 Answer

0 votes
Best answer

If you want to save exactly the whole branch under which your graph resides, you could try setting the local root as the owner of all graph nodes, and then use PackedScene functionality: https://docs.godotengine.org/en/3.0/classes/class_packedscene.html
Please note that this will only save what the editor would usually save. So for example, non-exported vars won't be considered.

I'd like to mention that, on the other hand, you can indeed save your own format manually, which is a lot more tedious but in some cases it's more correct because what you want to save is not an edited Godot scene (which may include a lot of things you don't care about or sometimes can't even be saved), but a graph for enemies. To better illustrate what I mean here, let's say you have a spreadsheets app implemented in HTML5. To save a spreadsheet, would you save the whole HTML DOM tree with a JS dictionary? Or would you save an ODS/XLS file?

So there is indeed a simple way to save nodes, just pick the method that you think is better for you :)

by (29,088 points)
selected by
Storing connections
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.