Download

Need Help With Inventory Array And Actor References

Hello, I’m trying to make an inventory system using Blueprints but now I have to consult with the forums for help because I’m running into a problem I don’t understand. Also I’m new here and this is my first post. I don’t really know how best to ask this so I’m going to show what I’m doing with screenshots and eventually we will get to the actual question.

Anyway, what I’m trying to do is have multiple pickup types like weapons, armor, usables, etc. so I’m starting with a base pickup class and using child blueprints for the different types. I’m also using an actor component for my player inventory.
Ignore the enums they’re not being used yet except for PickupType.

fbc96d77066aa9efb9f436df902915837edbacb8.jpeg
The cube in the viewport is an armor pickup and the cone is a weapon pickup.

The base pickup is used for the actual picking up of a pickup.

8d795c0b1491709b2f7721f4625230fe69f7b5b0.png

Then the event in my player inventory adds the pickup to a base pickup reference array.

fc26ccb853b9a3d62d1c34877ee4111d0c9c8059.png

But for some reason the pickup’s variables don’t get saved in the array.
Like when I try doing a print string of the pickup names for all my held pickups but the names all return as none instead of what I named each pickup.

Could it be because the array is a base pickup when the item I’m adding is a child of that?
Anyway I would appreciate it if someone who knew what the problem is could help me out.

Your array hold references of pickup objects. It looks like right after you call to add the pickup item to the list you destroy it (bottom of 2nd picture and last picture).

I think u should make an Array Class of your Item class, expand it to what number u want, then controll the array with set array element. If u make an array of item reference, and u destroy the item refer on pickup, it will no longer be added to your item refer array.

Checkout the Free Inventory in my signature. Its a whole Inventory in bp