How To Add To Inventory On Component Hit?

Are you using an actor component for the inventory? Or just an array on the character itself?

If you’re using an inventory component just drag off the other actor pin from the on hit/overlap event, get the component by class, then call the function on it which adds an item. Like so:

If you don’t have a function to add items, you can access the array var from the get component node.

Likewise if you’re just using an array on the player’s char, you can access it directly by casting to the character class like so:

Usually not a good idea to blindly add to an inventory array though, especially if you’re limiting the size.

1 Like