Persisiting Dictionaries in Resources

Godot Version

v4.3.stable.steam [77dcf97d8]

Question

I have a weird thing happening with the resources. One of my resource classes, “Rewards” has a Dictionary field, and it’s not getting saved. The rest of the changes save just fine, but this particular one goes poof the moment I launch the game (open a different object in inspector???)

class_name Rewards
extends Resource

@export var node_rewards: Array[StringName] #saves just fine
@export var unitRewards: Array[UnitData] #saves just fine
@export var next_encounter: Encounter #saves just fine
@export var resource_rewards: Dictionary #goes poof

Are you sure you saved them correclty? You have to press “add key-value pair” to actually add it:
grafik

Thank you, I was indeed saving them incorrectly. I thought I had to press it before adding a new element, like in arrays

1 Like

Yes thats a common mistake :sweat_smile:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.