inheritance in structs?
i am currently trying to make an inventory system in unreal and wanted to use a struct for the items, my idea was to have a struct that haves a name and then have children for Gun, consumable, resource, each of them with their own functions and variables, but i realized i can't make a children from a struct. is there any way to do this or get something similar using blueprints?
asked Aug 23 '18 at 08:43 AM in Blueprint Scripting
If you want functions and inheritance, I would use Objects instead of structs.
answered Aug 25 '18 at 05:25 PM
You can have an array of structs which can have an arrays of other structs inside. There is no struct graph where you can script things, though. Struct is just a collection of data that is easier to access.
Normally, you'd have an Inventory Actor that holds arrays of structs, and this actor would handle the inventory. Adding, Removing, Splitting, Finding, Replacing functions and so on.
answered Aug 23 '18 at 08:53 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here