The system you are using to create the inventory is not very practic, in case you want to add more objetcs to your adventure, increase the code you need to add, and thats not the way.
Things i recomend to you:
1- Create a struct with the objects you want to collect in the inventory. This struct can have a id for each object, the name of the objetc (if you create an ENUM to store the objects name, better!), the reference to his mesh, the reference to his icon(texture2d) etc, or any other things you need for the objects.
2- Create an array of this objects struct, and define all the objects you need. Later you can add more objets if you want to the array whiout problems. This array can be in the gameinstance blueprint, so you can access it easily from everywhere.
3- you can create a datatable to store the list of structs too, and then pass all this data to the array in the gameinstance at the begin play. This process is not necesary if you define your data directly on the array, but is a clean solution when you want to add new objects and do not want to touch the blueprints, only the data table.
4- once you got your objets data defined in the gameinstance array, you can give the object id or name you need to your actual worlds objects, using a variable, so when you touch one of those in the scene you know the Id or the name of the object you just got it.
5- Now you can have your update inventory code in your character, or even better in the gameinstance( remember the game instance is persistent across levels!) Create an array to store the ids or names of the objects, but dont define any element, we can do it dynamically.
6- the code on the object you just touch it, only need to pass the id or named of the objectasociated to him to the custom event input where you inventory code is. So the inventory know witch object to add.
7- In the inventory code you got two options now, if you permit several copies of the same object or not. If you don’t want copies on your inventory, just use “AddUnique” to your inventory array using the id or name of the object passed. Now you got a new element with your object id or name on it.
8- when you want to show you inventory, you only need to iterate across all the element on you inventory array, get the id or name object from every array element, and then using it, get the rest of the object data ( you got it on the objects array we prepared in the step 2. So now, you now the name of the object, his mesh, his icon, etc, sou you can change the image.
Width this system, if you later want to add more objest, only need to add it in the array, you don’t need to change the code anymore. And you inventory pool is not limited to a numbers of objects, is dynamic so you can have many.
If you need some help with the code. let me know.