Godot Version
2.4
Question
Debugging the inspector shows me that data is present, but when trying to access it in debug mode I get an empty array (egr at the bottom). This is what I get after loading the data
I’m using ResourceSaver and ResourceLoader as such:
static func createSave():
var instance: PlayerData = PlayerData.getInstance()
var rVal = ResourceSaver.save(PlayerData.getInstance(), PATH+pathPlayerData)
static func loadGame():
var playerDataLoaded: PlayerData = ResourceLoader.load(PATH+pathPlayerData)
if playerDataLoaded:
PlayerData.instance = playerDataLoaded
else:
print("Player data not found")
with a single data class to save:
extends Resource
class_name PlayerData
static var instance: PlayerData = null
@export var gold: int = 50
@export var maxCombatantLevel: int
@export var combatants: Array[Combatant] = []
@export var equipments: Array[Equipable] = []
@export var unlockedLocation: Array[FightingLocation] = []
@export var combats: Array[Combat] = []
func _init(): ...
I don’t know how much of the code I can put here, but the whole project on this branch is available and I constated the issue when stopping there: github com/pyrovoice/GuildManagerGodot/blob/resourceandsaves2/Combat/Combat.gd#L84 (add a dot, sorry I’m locked at two links) . At this point I try to access an array that’s shown to contain the loaded data but gives me something empty when actually accessing it.
I’m at my wit’s end as to what could be going on here, if you have any clue or stuff to try please let me know