Child actor component has authority on client

FadiBeyrouti
Sat, 07 Mar 2015 01:18:07 +0000
Multiplayer & Networking

Hi,

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:
LogHSM:Display: Parent Has Authority 1
LogHSM:Display: Child Has Authority 1

On the client:
LogHSM:Display: Parent Has Authority 0
LogHSM:Display: 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:
LogHSM:Display: Parent Has Authority 1
LogHSM:Display: Child Has Authority 1

On the client:
LogHSM:Display: Parent Has Authority 0
LogHSM:Display: 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?

Thanks,

1 post - 1 participant