Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | lalel345 |
I have many variables in a script for the different nodes is there a way to save them all together?
I know how to save with this:
func save(content):
var file = File.new()
file.open("user://save_game.dat", File.WRITE)
file.store_string(content)
file.close()
func load():
var file = File.new()
file.open("user://save_game.dat", File.READ)
var content = file.get_as_text()
file.close()
return content
but I have to do this with each variable to save is there a way to include many variables or save all the variables of the nodes in a faster way? that is to say, save all the variables in a line without having to go one by one.
I could use for
for a loop, but how?