Blueprint not recognising object array

I’m using a For Each Loop With Break on an array of bag slots for my inventory. The Loop is to check each bag slot for an existing item matching a new item that the player has picked up. If it already exists in the bag slot, it should stack the new item if there is room. If not, look for an empty bagslot instead.

All the bagslots are plugged into an array that is created on event construct (as well as optionally). So the array exists before the check is being run, even if the values are just the default ones and the bag is currently empty. That array is then plugged into the For Each Loop With Break, which is run whenever a new item is picked up in the game. I then want to pull the variables in the bagslots from the Array Element pin. However, neither the Loop node or the Array Element pin are recognising the array attached to it.

I’ve attached screenshots of the array and Loop. Can anyone see anything obvious that I’m doing wrong?

Hi SID_London,

What is a “Bag Slot” - is it a blueprint? You should change your array so it’s an Array of “BagSlot type” rather than “Object”.

2 Likes

■■■■ it, I knew it was going to be something obvious! :face_with_symbols_over_mouth:

Thanks, that’s fixed it! :rofl:

2 Likes