Godot Version
4.2.1
Question
Hi, I’ve been trying to save some data into a custom godot resource and I’m getting some weird errors? The code runs and the output is expected but I get ≈ 15 errors despite the code running?
This is my current resource class script (pretty basic, haven’t done much yet):
extends Resource
class_name data
@export var stat_array:=
@export var stat_dict:= {}
func set_array(array):
stat_array = array
and here’s my implementation of it after watching a couple tutorials:
func _ready():
var resource := data.new()
var save_file_path = “user://save/”; var save_file_name = “menu_array.tres”
DirAccess.make_dir_absolute(save_file_path)
resource.set_array(stats)
ResourceSaver.save(resource, save_file_path + save_file_name)
resource = ResourceLoader.load(save_file_path + save_file_name).duplicate(true)
print(resource.stat_array)
For some reason running “ResourceSaver.save(resource, save_file_path + save_file_name)” causes about 10 instances of this error:
E 0:00:03:0679 UI.gd:60 @ _ready(): Resource was not pre cached for the resource section, bug?
<C++ Error> Method/function failed. Returning: “null”
<C++ Source> scene/resources/resource_format_text.cpp:1853 @ _write_resource()
UI.gd:60 @ _ready()
and running “resource = ResourceLoader.load(save_file_path + save_file_name).duplicate(true)” gets 5 tween errors!?
E 0:00:03:0692 UI.gd:61 @ _ready(): Tween can’t be created directly. Use create_tween() method.
<C++ Error> Method/function failed.
<C++ Source> scene/animation/tween.cpp:499 @ Tween()
UI.gd:61 @ _ready()
Any help is greatly appreciated and thanks in advance!