Solved! i passed the file as an argument using get_buffer()
Basically, on server:
func save_on_server():
ResourceSaver.save(resource_used_as_savefile, path)
var file=File.new()
file.open(path, File.READ)
rpc(load_on_client(file.get_buffer(file.get_len()))
file.close()
on client:
func load_on_client(buffer):
var file=File.new()
file.open(path_to_temp, File.WRITE)
file.store_buffer(buffer)
file.close()
resource_used_as_savefile=load(path_to_temp)
Note: pathtotemp points to a file that doesnt have to necessarely exist.
Note2: the file has the .res extensions, it works with .tres as well (using get_as_text()
and store_string()
instead of buffer, but it seems slower to me)
Thanks Wakatta for your suggestions!