Replication issues

I recently came across a problem that my replication is not working. I have already tried to fix this many times and searched for information on various forums.

Get to the point. I have a function that does 3 basic things. 1 spawn objects, 2 delete objects, 3 upgrade objects to a new level. The function works fine on the server side, but nothing works on the client side. The function performs its actions, but it is not visible either on the server or the clients






if the player calls a function on the server, it will use the server variables.

ie you have a BuildingMode enum that isn’t replicated, so when you Multicast BuildObject each actor will use its own version of the variable.

what you need to do is either
Pass the variable to the server as an input on LeftMouseButton(server )and replicate it
OR
when you set that variable, set it with a Server RPC and replicate it back.

this goes for all player defined variables, so for instance BuildModeOn? etc

1 Like

Thank you for your reply. BuildModeOn is a variable that each player has their own. It seems that I just don’t know much about replication and I should take a closer look at This topic. But thanks anyway.

think of it like this, every action (for example building) should only ever happen on the server,

all the player sends is input, ie (i want to build here)

how much you verify that input to stop cheating depends on you.

good luck, replication is tricky when you start but it does get easier

1 Like

Hey,

This is a great doc for Learning Unreal’s networking - Multiplayer Network Compendium | An Unreal Engine Blog by Cedric Neukirchen

Make sure to set the Actor that you spawn on the server to be β€œReplicated”. This way it will also appear on each client and also dissapear if you delete it while on the server. For running upgrading code or anything really you can use a simple ROS and a MC event to replicate it. Simple