I've got the same error, it occurred because I edited the inventory.tres
file in the my windows system clear the pre loaded inventory items as I couldn't find any way to do it by code. But i made a copy of that original inventory.tres
file just in case.
After I replaced my edited inventory.tres
file with the previously created inventory.tres
file the issue was solved you might wanna check if the file is actually created or not,
The path to the file for me was
:C:\Users\UserName\AppData\Roaming\Godot\app_userdata\Forest
Forest here is the name of my game.
The inventory.tres
looks like this when opened:
[gd_resource type="Resource" load_steps=4 format=2]
[ext_resource path="res://Items/Note.tres" type="Resource" id=1]
[ext_resource path="res://Player/Inventory.gd" type="Script" id=2]
[ext_resource path="res://Items/Stick.tres" type="Resource" id=3]
[resource]
script = ExtResource( 2 )
_items = [ {
"item_reference": ExtResource( 1 ),
"quantity": 5
}, {
"item_reference": ExtResource( 3 ),
"quantity": 10
}, {
"item_reference": ExtResource( 1 ),
"quantity": 1
}, {
"item_reference": ExtResource( 1 ),
"quantity": 1
} ]
This was my reference:
I am a beginner at this, hope I helped :)