Inventory Help

I have a base class for all the items i am able to pickup; I use a struct for this.

Inside the two child actors they are setup like this.

When i pickup an item it sets my variable “ItemInfo”

The only problem is when i pickup a gun it sets my “ItemInfo” variable but then when i pickup another gun it overrides my previous settings for the variable.

Here is a video of what the problem is like in-game.

As you can see from the video the variable gets set from what is last picked up and this causes a problem because i cant drop any other item but what was last picked up. Any ideas on how to fix this?

You need a collection (Array) of weapons stored somewhere. When you pick up a new weapon, add it to array of weapons instead of a single reference.

here’s a very good tutorial from titanic games Unreal Engine 4 - Inventory System Part 1 (Part 11) - YouTube