The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates.

godotengine.org | Twitter

+1 vote

Hi everyone,

I have an inventory system that I save using ResourceSaver.save("user://inventory.tres", inventory) so that I can load it when the game starts. The problem I'm having is that it when I than load the inventory using load("user://inventory.tres") I get this error when I call a function on it:

Invalid call. Nonexistent function 'get_items' in base 'Resource'.

Now when I save the items, it's of type Inventory but then when I load it, it's of type Resource. Does anyone know what I can about this?

in Engine by (17 points)

So what is Inventory here? That's not a built-in type!

I've tried several different things and I am unable to reproduce this using 3.2.3. Are you able to upload a minimal reproduction project?

1 Answer

0 votes

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 :)

by (53 points)
edited by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.