Hi guys,
i made an Inventory System in my C++ project where I have a class “Item”. My actual items are then blueprint classes derived from my C++ class “Item”, such that I can modify the name and other factors manually in the respective blueprint. If I gain an item ingme, then this item is added to my inventory, which is a TArray of TSubclassOf of Item. In my inventory widget I now display some random image on the corresponding inventory slot, whenever this slot is occupied by said item.
I then added a UTexture2D* image to my “Item” class, such that each item has its own display image in the inventory. But since my inventory contains only TSubclassOf objects, I have not instantiated anything, so I am not able to access the item images from my inventory.
Am I somehow able to still access the variables from the blueprints I made? I could of course, whenever I gain an item, instantiate it and add it to the inventory (if I change the inventory type to simply a TArray of Item*). This would all work fine I tried it. But then I completely unnecessarily have multiple invisible Actors flying around in my scene and have the exact same properties (for example if I cut multiple logs or mine multiple ore etc.). If I later want an option to drop an item, then I want it to be spawned with an actual mesh and position. But right now I only care about their “inner values” and how to access them.
If any of you guys have a solution for this or think my way of doing things is completely retarded, please let me know. Thank you for your help.