How do I add an item to my inventory?

I have my inventory already created on screen with the coordinates for all the slots saved in an array. What I am trying to do now is create an item and place it in my inventory so it shows up when I push the I button. I have looked around at a few different tutorials on this subject but most of the ones are for network games, and I am creating a single player game and do not need to worry about this. I can’t seem to wrap my head around what is actually needed to make the blueprints work properly.

On a side note, I am an experienced programmer and could probably accomplish this in code but I am trying to make everything using the blueprint feature. Is there no way to just create a blank Item object like you would in an oop language like java or c++? And then when u create a blank one u just set the attributes to that item immediately after its created then send it to the inventory array. This is what I was trying to accomplish with blueprints but cant seem to figure out how.

Have you investigated the Structure asset type? You can create a new Structure asset and assign it all of the variables and default values you want, then in your blueprint you can do a “Make MyCoolNewStructure” and then add that to your array.

wow, i switched to a struc array from an actor array and it instantly worked. thank you for the suggestion.

Can structures still be used when interacting with items in the environment? I know that you need to have an actor that is the item in the world, can it just inherit the values from the struc and spawn in the world? And then I make the action for it to add to my inventory struc array and destroy the actor from the world, and if i were to drop it generate the actor from the struc array?

If what I am describing above is correct in some way I am beginning to understand this.

I think you are on the right path. You will probably need a custom blueprint for a “dropped item” sort of thing. This blueprint would be the actor you spawn when it drops and when you create it call a function and pass the struct as an input. Then you can house the logic in the dropped item blueprint for handling the struct to generate anything like what mesh should display, etc.

Could anyone describe in more details, please, how to connect Structure and actors arrays with inventory widget which has widget slots to spawn an item there.

I am a newbiew to blueprints and does not have C++ skills. I just followed this official guide Drag & Drop with UMG | 02 | Live Training | Unreal Engine - YouTube to create my inventory but can’t figure out how to spawn item in inventory instead of picking it up.