Unable to increment variable with duplicated child blueprints

Hi, this is my first time on here! I am relatively new to programming in UE.

I am working on a personal project using blueprints in UE5.3. I have an array of structs I am using for my inventory system and I am able to add only the first instance of the blueprint. I have a quantity property of the specific item’s struct in the inventory that I am incrementing by one each time the item is “picked up”. I made a parent blueprint and made children blueprints that derive from the parent. I am also using a Map with an unique identifier for each item.

The issue comes in where I am unable to “pick up” any other instance of a specific item blueprint in a level except for the very first one (index returns -1). This occurs for each unique item blueprint. I am using the overlap event and a key to pick up items.

I feel like this may be an easy solution, but I’ve been at this for days. I would appreciate the help in solving this. (: I attached my code below. Please ask for any clarification if needed.

Note: I’m at a very early stage of this system and I am aware that the code may be ‘inefficient’. This is my first project and I am still learning, so please feel free to provide kind guidance. ^^

Gatherable BP: Adding child bps to inventory posted by anonymous | blueprintUE | PasteBin For Unreal Engine

Game Instance BP:

Item Struct:

Scene Setup:

Update - I redid a part of the code, and I found out that the index increments from 0 to 1 for the first item. However, I’m unsure how or why. I posted my updated code below:

New BP flow: Newbp posted by anonymous | blueprintUE | PasteBin For Unreal Engine

Macro I’m using to compare structs:

New code in editor:

UPDATE: Found a solution. Used a for each loop and only compared the name for each struct. (:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.