I have the following
extends Node
class SaveData extends Resource:
export var data : Dictionary
export var data2 : String
func _ready():
n()
l()
func n():
var d = SaveData.new()
d.data = {"test" : 1, "another test" : "oranges"}
d.data2 = "String member"
ResourceSaver.save("res://data.tres", d)
func l():
var d = load("res://data.tres")
print(d.data, d.data2)
When this script runs, I get an error failed to get index 'data' on base(Resource)
. What I don't understand is, I'm exporting the variable in the class, I've used a .tres file extension just to that I can verify the data is actually being saved in the file (which it is). Why am I unable to get the data being saved here?
I do not want to use JSON to save my game data due to its limitations.
Any ideas?