TL;DR: Sorry for wall of text. How do I replicate a nested inventory system where item and inventory are UObjects?
I am trying to make an inventory system where items can have their own inventories (for weapon attachments, containers, etc). Both the logical inventory and the logical item is UObject (UItem and UInventory).
The inventory contains a size + list of item pointer. The item contains the dynamic item state, fragments and reference to it's definition.
My issue is this. I have no idea how to cleanly replicate this?
My instinct was that the Item can be replicated subobject of the Inventory, but after looking at source, that it not supported.
An alternative would be to have a global AInfo actor spawned by subsystem or a GameState component replicate them. But that introduces new issues as well (e.g. messy GC). This is the best solution I have found so far. The original design was doing this, and I went away from it because I did not like that everything depended on it.
I really like both UInventory and UItem being UObjects , because it makes the blueprint API, and logical model very simple.