I am trying to create an inventory system, been having a lot of struggles but finally got something structured but when testing my inventory system is not containing the item I am trying to add. For testing purposes I am just adding an item when pressing left shift. in the debug I can see all the variables going through the game play flow correctly however as soon as it enters the ‘add’ node for an array it doesn’t update the array but also don’t get any error messages.
if you are wondering, Inventory is an actor component, inventory slot is a structure with Item and quantity variables. Item is an Actor and ItemStick is a child actor of Item
When debugging, shows all variables are ok however after finishing all the default values on the side are the same.
In first pic I see, that you got 10 slots by default. Add node is used to add new slots so if you in construction script our begin play making 10 empty slots is better to set the items value by using set array element and not create new slots xD.
Let’s talk about structure. Can you post a pic with the item definition type and the code when you call add item in the slot
And here is my add item function (you can tell by the first screenshot that the correct information is being passed, the quantity says value = 1 which is correct).
that’s because there are a few checks that the data gets passed through such as checking if it is stackable, then checking if inventory already contains the item etc, and if it doesn’t THEN it will add to the end of the list, I didn’t want to take 5-6 screenshots showing the full flow of the code that’s why my second screenshot was the debug showing that the data DOES make it into that function correctly, so this is the right function, data gets called there, but doesn’t get added.