Variable not replicating at all to server and print showing 2 clients and 2 servers

I started making a multiplayer building game with blueprints. I just added a feature to my blueprint and didn’t change anything and now for some reason, my mesh variable isn’t replicating at all to the server even if it is created on the server directly. Weirdly, whenever I run it as listen server and client and print the value of it, it shows 2 clients and 2 servers. If I just print it as a client it just appears as the server having it blank. Whenever I just play as listen server, everything replicates to the server
fine.



2 Likes

Read the Docs. Static meshes Do Not Replicate.

Jump to the “Replication” section.

Several common features of actors, pawns, and characters do not replicate, such as:

  • Skeletal Mesh Component
  • Static Mesh Component
  • Materials
  • Animation Blueprints
  • Particle System Component
  • Sound Emitters
  • Physics Objects

Event Begin Play executes on Autonomous, Simulated and Authority proxies.

I looked into it a little bit more and realised it isn’t the fact that the component is a static mesh, it is the fact that the server just isn’t creating the component at all. I tried creating the component in an On Server Event and a Multicast event, but the component isn’t ever created even on clients if I do it this way.

Money $$$ says it’s because the character cast fails due to it being called too early.

Add a 0.2 delay on the begin play.

That seemed to have fixed it! I was a little confused because I had put a print to see if the player cast failed and it never said it did for some reason. Thanks!

that’s a hack btw. shouldn’t rely on it. a packaged game using that will fail on quite a few players.