Just browsed the source code and reread the docs for some time. Hereâs what Iâve got to know if you are interested.
First of all UActorComponents are also UObjects. The ways to replicate UObjects also apply to them as the docs say.
If you call AActorComponent::SetIsReplicated(true), it basically adds the component to its ownerâs (an actor) ReplicatedComponents for replication.
If you want to use the ânew methodsâ (subobjects list) to replicate, youâll need to set bReplicateUsingRegisteredSubObjectList to true. Letâs see the comments on this variable, which is false by default:
When true the replication system will only replicate the registered subobjects and the replicated actor components list
When false the replication system will instead call the virtual ReplicateSubobjects() function where the subobjects and actor components need to be manually replicated.
The default implementation of ReplicateSubobjects (only called when bReplicateUsingRegisteredSubObjectList is false) iterates through ReplicatedComponents and call Channel->ReplicateSubobject to make them replicated. You can read that this method is old, deprecated somehow from their comments and symbol names. Youâll need to override it if you want to replicate other subobjects.
If you want to use the new method, just bReplicateUsingRegisteredSubObjectList to true and use AddReplicatedSubObject to add them to the ReplicatedSubObjects.
But actually in AActor::BeginReplication, both ReplicatedSubObjects and ReplicatedComponents are iterated.
So I guess for ActorComponents itâs okay to call AActorComponent::SetIsReplicated(true) no matter which method you use.
You can find the declarations of the stuff mentioned in Actor.h and ActorComponent.h. Some of the definitions are in ActorReplicationBridge.cpp.