Child actor component never replicated


UE 4.6.1

I noticed that a child actor component is never replicated. For a test, I Created a parent actor class and a child actor class, then I set the child actor class as the child actor component or the parent actor class. I added some logging in the PostInitializeComponents of both parent and child actors and here is what I got:

On the server:
Parent Has Authority 1
Child Has Authority 1

On the client:
Parent Has Authority 0
Child Has Authority 1

I found no way around this, until I changed engine code as follows in childactorcomponent.h:

virtual bool ReplicateSubobjects(class UActorChannel *Channel, class FOutBunch *Bunch, FReplicationFlags *RepFlags) override { return true; }

After this change I got the expected output:

On the server:
Parent Has Authority 1
Child Has Authority 1

On the client:
Parent Has Authority 0
Child Has Authority 0

Obviously this was a test change. One way is probably to derive from UChildActorComponent and override the function ReplicateSubobjects, but it seems I need to do this in the engine (in the game dll symbols of UChildActorComponent are not external to the engine.)

Is this the only way I can have child actor components replicated?

Or am I missing something?


This is not the way to replicate child components. In your actor component class, did you set it to replicate with SetIsReplicated(true)?

SetIsReplicated does not seem to be working. As far as I can tell SetIsReplicated is:

  1. meant to be used on default subobjects (not my case, component is added in blueprint)
  2. meant to be used on dynamically spawned objects (not my case either, as the object and its child actor component are static in the scene)

Also after further tests, I was wrong in saying that my changed did succeed in replicating the child actor correctly.

As far as I can tell there is no way possible to replicate a child actor component!


Question, are you replicating the actor itself, or the ChildActorComponent? Try each, then try both.

I’ve been working on a project where we use SetIsReplicated to dynamically spawn replicated components and add them to a replicated actor. So to clear your doubts about whether its possible to replicate a child actor component, it certainly is. Child components that are known pre-begin play should be easier to replicate than dynamically spawned components.

One thing I may have misunderstood from your first post. Is your child component an actor (inheriting from AActor) or a component (inheriting from UActorComponent, USceneComponent…)?

Also, you mention that the child components are added in blueprint. Where is that, in the construction script or at begin play? Note that in both cases it would count as dynamic spawning. Both server and client execute the construction script and BeginPlay event. If we are dynamically spawning then you have to (1) set the actor class and component class to replicate and (2) make sure the actual spawning/attaching only happens on the server.

Tried each, and both. No luck.

Thanks for answering.

The child actor is an actor, not a component. So It is an actor connected to the parent actor via the child actor component.

Here is how the system is setup:

  1. in C++ code I define a parent actor class and a child actor class (bReplicates = true on both of them).
  2. I create a blueprint that derives from the parent actor C++ class.
  3. I create a blueprint that derives from the child actor C++ class.
  4. I add a child actor component to the parent blueprint (in the components tab, not dynamically at begin play, but as part of the blueprint itself) and link both actors there.
  5. In the PostInitializeComponents of the parent C++ class I get the child actor component and call SetIsReplicated(true) on it (if HasAuthority)
  6. I add the blueprint to the scene (no dynamic spawning)

Somehow on the client, the parent is always a replica (has no authority) while the child always has authority.

I see, your setup is clear to me now. I didn’t realize there was a “Child Actor” component type! I’ve looked at the source of that a bit (ChildActorComponent.cpp) and it seems that it creates an instance of your selected actor class no matter whether its a server or client. Replicated or not replicating the component itself makes no difference since it spawns a new actor of the class you selected. So rather than being the actual child component, it is a component that spawns another actor and attaches it to itself.

Perhaps this is a better alternative to what you’re trying to achieve: drag both actors into the map, obtain a reference to both actors and use the Attach Actor to Actor blueprint node, for example in the level blueprint.

Yep, that is what we are doing finally. Except I was expecting that the child actor component would have that functionality, or at least an option to trigger it.

Thanks for your help.

It would be great actually if we have some feedback from Epic on whether this will be tackled or not.


This issue still exists. My workaround was to (on the server) on beginplay, spawn the actors, attach them to the player actor, save the spawned actor as a replicated variable. Every client would check if those variables were valid every second until true. Works fine.

Same here, the Child Actor Components do not replicate on the client on the standalone. One workaround we used was to create an RPC for the server to spawn the individual components. Very suboptimal though.

Still exists it seems… Been pulling my hair until I finally decided to google, this was the first hit… Should have googled earlier, now i’m almost bald.

Thanks for verifying it tho.

I think I have a similar Problem. I am very confused, does that means Child actors are not “replicated” when you add them to the Pawn directly and not at runtime?
What’s the reason for this? Is it a bug or a feature? :slight_smile:

I thought before about the way to spawn the child actor at runtime and then replicate it. But then I thought its much better to do attach the child directly so the spawned pawns already have the Child Actors attached. In “Editore Gameview” and in “New Window” everything works fine with this solution as intended. No problems, actions in the child actors are replicated fine.

But switching to “stand alone” game shows me, that the child actors on clients are not working. Multicast on server child actor does nothing on clients child actors. I activated replication of course in the BP which is taken as child actor. Also in the “parent” pawn bp I activated everything I found to activate replication for the child, but it is not working.

Why it is working for Actor Components and not for Child actors? Or do I miss something.
If this is not possible and I have to spawn and replicate at runtime I would prefer to go with actor components. Is there any possibility to convert from actor to actor component (of course everything, but not “viewport related”, because actor component does not have this)

My settings in parent to show I tried to set everything to “replicate” on the child what I found:

@TheFlow3k My guess is ChildActor component actually spawns and attaches an actor locally at start. Which would mean every client has a unique actor as the ChildActor, thus no replication.

Thank you. That really would explain it technically. But I do not get the point why UE4 is doing that, when all replication settings are set to “true” as seen in my screenshot. For every other component you switch on replicate, it will be a replicating reference between Clients and Server. I do not see the great sense behind it doing it like that and think its very confusing.

Child Actors break a lot of conventions in the engine.
I believe it needs a complete rework.