So i am working on a inventory system.
The code i have set the “Pickable” item on the ground to an element array of “Pickable” class .
and then i destroy the object in the ground.
after destroying the object i lost the reference in the array element…
That array is my inventory.
How can i keep the object that i grab in the array but destroy it in the game world?
The reference in the array is of the actual object, when the object is destroyed the array now has a reference to nothing.
What you need instead is an array of a struct to copy over all the relevant data from the object you just picked.
Like, object type, stats, etc. Whatever you need.
But you absolutely can’t access an object after it’s been erased from existence.
So in that case i can’t use the functions i have on the Item BP, right?
Like if i do that, imagine that when i touch the E Button i want to run some piece of code in Item BP, like Eat() , for example.
All codes should be moved to ThirdPerson Character BP?