I am facing some rather interesting and frustrating behavior with component replication. I am implementing a structure building system which can only be compared to a mixture of Unturned and Fortnite. I am going about this by spawning a StructureObject actor, passing a static mesh to the construction script with then adds that mesh to the object. However during that script we must set the newly created mesh component to replicate in order for the mesh to be shown on the clients. So far so good.
Unfortunately this results in some odd behavior. When running in singleplayer this works as expected however once we fire up a dedicated server the fun starts. Upon attempting to place an object the client appears to respawn and all following object placements work as expected.
Firing up two clients reveals what is really going on. When client A attempts to place an object said object appears on client B’s screen and client A disappears from client B’s view as client A “respawns”. Placing an object on client B causes it to “respawn” and the world to be cleared of placed objects. My theory is that when a player tries to place an object he is disconnected from the dedicated server and connected to an internal listen server thus the “respawn” or “reset” effect.
This occurs regardless of where in the blueprint, which blueprint, or when the Set is Replicated node is called. If I put the Set is Replicated node (and only that node) on a five second delay then the client disconnects five seconds after attempting to place the object.
Below is a screenshot of the construction script in which I am currently calling the Set is Replicated node. What am I doing wrong?