Currently I’m developing an RTS-inventory-system and want to replicate it now.
Basically, I have an ActorComponent (UInventory) that owns UObjects (UInventorySlot). Those Inventoryslots control the current storage and max storage of the current item and own another UObject(UInventoryItem), which contains Metadata.
I can’t replicate the UObjects. I actually don’t want to use a AActor or AInfo, because these classes have many unnecessary functionality and I don’t think that an ActorComponent owning Actors is a good thing.
So how do I replicate this, is there a good documentation/tutorial on how you can replicate UObjects or do I have to use AActor/AInfo for this?
Or is my approach generally not good and I should do this completely different?
It is true, classes like Actors contain vast amounts of functionality when in reality we only want to use 1/3 of it. However, within all that functionality is the logic behind replication. It is not something that is simple to reproduce at all and will probably be very time consuming.
I highly doubt there is any decent documentation out there for how actors replicate. I guess you would have to open up the actor class from the source and attempt to extract the replication logic.
However, I would suggest you save yourself alot of headaches and just use the actor class
Old thread but I was able to replicate UObjects by overriding ReplicateSubobjects on the owning UActorComponent and manually replicating the array of UObjects, which in your case would be your UInventorySlot. And on the UObject you need to override IsSupportedForNetworking to return true.
Old thread but I was able to replicate UObjects by overriding ReplicateSubobjects on the owning UActorComponent and manually replicating the array of UObjects, which in your case would be your UInventorySlot. And on the UObject you need to override IsSupportedForNetworking to return true.