Hi everyone,
I’ve recently started learning C++ in Unreal Engine after spending a lot of time with Blueprints. I’m currently building a simple multiplayer prototype and wanted to create a custom actor entirely in C++ that can replicate its position across the network.
Here’s what I did so far:
- Created a class inheriting from
AActor
- In the constructor, I called
SetReplicates(true);
andbReplicates = true;
- Overrode
GetLifetimeReplicatedProps()
and added my properties usingDOREPLIFETIME()
- Spawned the actor on the server using
GetWorld()->SpawnActor<>();
The actor spawns correctly for the host, but doesn’t appear at all on the client. I even added NetMulticast
debug logs to check if replication is triggering — but no luck. The logs only appear on the server.
Some things I’m unsure about:
- Do I need to manually call
RegisterAllComponents()
orForceNetUpdate()
after spawning the actor in C++? - Are there differences between how Blueprint Actors and C++ Actors handle replication by default?
- Should I be setting any additional replication flags or using
SetReplicateMovement(true)
for positional sync? - When exactly should I use
NetMulticast
vs. replicated variables for syncing things like transforms or effects? - Could this be an ownership or authority issue? The actor is spawned on the server, but maybe I’m missing something with
SetOwner()
?
I’m trying to stick with good multiplayer practices early on, and I’d love to understand not just how to fix this issue, but how to think through replication logic properly in C++ for future systems like weapons or projectiles.
Thanks in advance for any help — I know this stuff is tricky, but I’m excited to keep learning and eventually contribute back to the community.