Thanks for you guys reply. I think I know my problem now.
inventory_data.gd
class_name InventoryData
extends Node
@export var item_datas: Array[ItemData]
func save_item_datas() -> Dictionary:
var datas: Dictionary
for items in item_datas:
if items:
datas[items.name] = items.resource_path
return datas
func load_item_datas(data) -> void:
item_datas.clear()
var item_counter: int = 0
for items in data.inventory_data:
item_datas.append(load(data.inventory_data.values()[item_counter]))
item_counter += 1
print(item_datas)
I forgot that inventory supposed to be dynamic and I should save item in inventory individually, but I instead tried to save the whole inventory_data because it’s a resource. I think that is my problem.