I’m having trouble with replicated subobjects for an inventory system, and these results are very concerning. Hopefully someone can shed some light here:
- Two actors (A and B) with “ItemContainer” actor components
- ItemContainers are just replicated TArray of pointers to replicated UObjects.
- Adding / removing items to these arrays renames (to change the outer) and appropriately assigns subobject list replication.
- Renames are also sent to the client (to change the outer on the client)
- Moving an item from A → B works fine, the subobject is networked.
- After some delay I destroy actor A.
- Checking slightly later in B, the array still contains a pointer to the object, but the pointer to the subobject is now invalid. It becomes invalid instantly after A was destroyed by the server.
So I guess that means only the original networked pointer is meaningful on the client? Am I doing something wrong here? This seems to make working with replicated subobjects completely useless if we’re expecting them to act independently of their original replicating owner. Seems like a pretty obvious way to implement an inventory system would be to use subobject replication in this way.