Actor Component Replication?

Hi guys!

I was delving into the wacky world of replication this week and hit a brick wall. I attempted to make a simple asteroids-esque shooter. All was well – the ship flys around and can fire little bullets … and all of it replicates fine. I then thought to myself: what if I had more than one gun, and have them rotate? I decided to add a few scene components to my ship and have them rotate based on a button press. No matter how hard I try I can not get the scene components to replicate. I can see it fine on the active client, but all other clients and server do not see the additional component-based guns moving. Is is possible to replicate an actor’s components? What is the real way to rotate parts of actors over a network?

1 Like

However you are rotating the child components the server must be informed about it, make the change and replicate that change to the other clients.

There is a node especially for components called “Set is replicated”. When you create it you’ll probably see something like “Set is replicated (CameraComponent)”. If you set this to true and call the function and you hopefully can solve your problem.

You maybe should combine this with a custom event that gets called only on a client, not a listen or dedicated server, when a rotation is done.

See here: Component Replication in Blueprints

Did this help?

Best,

Huppys

Ok, so I think I got it!

There’s no replicate checkbox on scene components, so that didn’t pan out. I used the “Set Is Replicated” node on a scene component and made sure to have the server drive the movement. Seems to be doing the trick :smiley: Thanks guys!

P.S. Why is there no checkbox for replication on almost all components? Why do we have to manually set this up within blueprint?

Only Actors replicate, and they replicate all their components, so it doesn’t really make sense for components to be set to replicate at the component level. If their parent actor doesn’t replicate it wouldn’t do anything.

There is a checkbox as of 4.17.2 (maybe earlier) now, on Components, something like “Replicate Component”. I wonder if that would do the trick?

Components can directly replicate their own properties and RPCs.