Hi everyone.
I’m trying to make an inventory system in c++ and I need to replicate a hierarchy of UObjects. I understand I can replicate an actor’s subobjects but I can only do it one level deep. I would like to have a UObject representing the inventory which will hold an array of UObjects being the items. I thought about UObjects because I need to replicate the inventory as a property to any actor and make use of the condition replication for each different inventory. For instance a character will replicate the inventory to the owning conection only but a box in the world will replicate it to everyone.
As I failed to replicate a hierarchy of UObjects I thought about making everything an actor but I face the problem of conditional replication which will demand a diferent actor subclass (UserInventory, BoxInventory) for every condition and the corresponding Item subclasses.
The last thing that I considered was ActorComponents but I’ve been trying to find some documentation about replication involving a hierarchy of components and if the replication conditions are taken from the UPROPERTY() holding them or if they are replicated independently which will face me with the same problem as with actors
Also used structs and it worked perfectly but I need to use the reflection system to be able to instance different classes of items based on a string on a data table and I can’t do that with UStructs. Also I will need later on to hold a reference to the structs (decay system maybe) and there are a quite a few problems with that.
Everything else I’ve considered seemed really hacky and a problem further down the road.
Any ideas?