Download

Having problems with my inventory system. Inventory doesn't save item information.

Hello,
i’m having a problem with my inventory system. Basically im trying to safe a reference of a item in the world in my inventory array and destroy the actor afterwards. Here are some screenshots of the most important parts:

In Character Blueprint:
Line Trace:
9509d810d9741061760c1c0647f6e61f1b82b47c.png

I use this to find Items:
36c693d338f082776d2530eb30a43e9545d59277.png

If i find an item i add it to my inventory:
fe12c3f251ca20e2166703923b4f20abba1858e9.png

In an Actor Component (BP_AC_Inventory):
Add Item to Iventory (without destroying the actor afterwards):
12f09164c6cbb836e909a3523390622b3b37a6a5.png

Testing the inventory (everything works fine):

Here comes the problem! As soon as i try to destroy the actor after i collected it the inventory doesn’t safe the information contained in the actor.
Add Item to Inventory (with destroying the actor afterwards):
12f09164c6cbb836e909a3523390622b3b37a6a5.png

Testing the inventory (print inventory doesn’t show the items id and name):

Can you help me to fix my issue? I want to safe the actor in my inventory and remove it from the world afterwards.

The moment you destroy the actor, you invalidate the reference you’re keeping in the inventory.

Try storing all the actor data in inventory instead of the reference.

Okay i fixed it by storing the class instead of the reference in the inventory. It doesn’t matter since i intend to use only the class defaults anyway. Here’s a picture. Picking up (destroying the actor) and dropping works now. Thank you!
5ce8d3be5ac2aeeb569bdc36212d61ca3e682d39.png