Godot Version
4.5
Question
I am working on a 2D RPG which has 3 different inventories. These inventories are stored as typed arrays within their own resources so that they can be easily accessed throughout the game. This used to work just fine, however very recently (in the past week or so), this suddenly just broke when it’s connected to my menu system.
I have it so each menu that acts alone is its own scene, which are instantiated and deleted as the player chooses certain options and goes back. Each menu has its own script handling its functionality, with the menus that need to access the inventory referencing them as such:
@export var item_inventory : ItemInventory
![]()
Thus, it doesn’t create a new instance of the inventory.
Now here’s the actual issue if you’ve been skipping over my infodump: Sometimes when I try to access the arrays within the inventories, it simply will not work, and the array will return empty. I can not discern any pattern to this. This error:
![]()
Appears as it attempts to access the arrays.
I will give everything I know about this issue. When accessing the item inventory, this problem only occurs for the combat item menu and not the main item menu outside of combat. This issue also occurs for the weapon and armor inventories when trying to update the list of armor or weapons, an issue which did not happen before. I haven’t done any work with the weapon and armor inventories since I finished these menus.
These errors:
![]()
Are thrown as I load into the combat scene. It doesn’t tell me which array is causing this issue, but I can only presume it is the inventory arrays that I already know have issues. These errors do not appear in the overworld scene where the weapon and armor inventories have issues. I have tried removing the typing from the arrays, to no avail.
Last thing to note is that the battle item menu works just fine when ran as its own scene. However, the equipment menu still has this issue even when when I run the scene individually.
This has left me scratching my head and, like many roadblocks, slowly losing my mind as I become more confused as to what the issue could be. I’ve tried looking it up, typing my issue into google and even putting in my errors, but the issues I find are varied and don’t really apply to what’s happening here. The closest I saw was that it could be a bug with the engine, but I’m not sure. Any help would be greatly appreciated.
