Hey everyone, I am pretty new to unreal. I want to pick up my item and add it to the player inventory after that remove the item from the world. But I don’t know how to keep a valid reference so the garbage collection doesn’t try to delete it after I call “Destroy Actor”. An idea was to just hide the item but that seems more like a workaround and not a solution.
Well, I added the reference to the array and destroyed it after because I didn’t know how to do it otherwise. I got it working with the struct now tho.
Can you explain how I would do it with the reference? And what would be the benefits?
I was referring to Uobjects I think you’re using actors. if you wanted to use actors you could just hide/disable collision instead of destroying it but that could be expensive if you have 100s of items.
the advantage of objects is they’re modular, you can have a weapon item and an armor item with difference variables for instance, you can also run code on objects. so say a weapon has ammo i handle reloading on the object itself