Godot 4 Vedta 2
With the new file system, I can't read the saved objects.
The problem seems to be, that it can't decode the objects.
I understand that you have to put "true" as a parameter in the storevar and getvar methods for that effect.
In version 3 I had no problem.
func save_ships():
var path = "res://factions_data/" + Global.faction + ".ships"
var file = FileAccess.open(path, FileAccess.WRITE)
file.store_var(ships, true)
func load_ships():
var path = "res://factions_data/" + Global.faction + ".ships"
if FileAccess.file_exists(path):
var file = FileAccess.open(path, FileAccess.READ)
ships = file.get_var(true)
When the process reaches ships = file.get_var(true) stops.
The debugers says: Parser Error: Class "Ship" hides a global script class.
The output says: editor/debugger/debugadapter/debugadaptertypes.h:70 - Condition "path.isempty()" is true.
The variable ships is an array of objects made with a custom class, named "Ship".