Hello, I am still quite new when it comes to game development and I am trying to build inventory system and so I have following structure for pickup items.
Classes:
_Item (Parent)
- Food(Child)
- Ammo(Child)
- Weapon(Child)
- Water(Child)
I am following a tetris system design and following is my structure for Widget UI of Inventory:
My Struct for - for example - Ammo looks as follows:
I then place the ammo item, and set what type of ammo it is, etc.:
Setting item in World:
My problem is I want to store these details with Item Structure itself. As you see I set up alot of things when Item is spawned in the world:
but when I pick up the item, I destroy it, resulting in my O_Item becoming “unknown Class”. and it gives me error that I am trying to access Ammo Class which is pending to be killed. I am trying to find a solution for this but having a difficult time.
I basically need to get UUID from the class to compare it for tetris inventory system and check if they are same kind of items or not, if not, then store them separately:
Problem is, I cant save it in the AC_Inventory array because its actor object of ammo is destroyed once I store the data in the array:
If anyone can help, please let me know. Thanks! I am still trying to find some solution as to how I can save it. Maybe I can save it as a class reference and not an object reference? WIll that work? I dont believe it would but I might give it a shot if it doesnt. Anyways, It would be great if you guys can let me know how do it and also, I also need to use the class later to recreate the item if I drop it.