+1 vote

how to encrypted ResourceSaver save file?

var new_save = save_data.new()
new_save.save_1 = global_object.player_current_data 
ResourceSaver.save("res://save_1.tres", new_save)

this how i do with json

var file = File.new()
var error =file.open_encrypted_with_pass(save_path2,File.WRITE,"123")
if error == OK:
    file.store_line(to_json(new_data))
    file.close()
in Engine by (423 points)

1 Answer

+3 votes
Best answer
var new_save = save_data.new()
new_save.save_1 = global_object.player_current_data 

var file = File.new()
var error =file.open_encrypted_with_pass("res://save_1.tres", File.WRITE, "123")
if error == OK:
    file.store_var(new_save, true)
    file.close()
by (6,934 points)
selected by

use file.get_var(true) to load whole sceneTrees can be saved and loaded this way

How can we load and access variables from this file and save them?

Recommend using var2dict() and dict2var() in that case and know that regardless of the method, reference pointers will be lost when saved.

Another method would be to use _get_property_list after creating a reference for the loaded data or simply do

var save_data = file.get_var()
save_data.my_variable
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.