Why doesn't replication work outside of PlayerCharacter?

I can spawn projectiles and replicate anything I need just fine within a Blueprint that inherits from PlayerCharacter. But the moment I start calling “FireProjectile” etc on other blueprints they are not replicated. Yes I have RPC functions in the other blueprints, but nothing appears to be working. I’m sure this is something simple.

  1. Session is joined
  2. On PostLogin the Game Mode spawns the PlayerCharacter and Possesses it.
  3. In BeginPlay on the PlayerCharacter we set up UI and spawn the weapon the player is holding
  4. When PlayerCharacter calls RPC functions on the weapon, nothing happens. If I move all that code back into the PlayerCharacter everything works

The weapon is visible on all game clients so it looks like it replicated just fine.

What am I missing?

In this image below I am calling the RPC function of the weapon. Note that the projectile spawns if playing single player, but in multiplayer nothing spawns.


Ah that was my mistake, I didn’t have EquippedWeapon as replicated. One thing I DO find weird is that even without spawning the weapon on server, it appears on all game clients. That helped with my confusion on why the BP wasn’t working. But oh well, its working now. Thanks

Here is a checklist

  • SpawnWeapon should only be called on the Server (SwitchHasAuthority)
  • EquippedWeapon variable has to be Replicated since the server spawns and Sets this variable.
  • BaseFirearmBP variable “Replicates” has to be true
  • BaseFirearmBP variable “NetUseOwnerRelevancy” should be true so it can inherits the character relevancy.
  • Inspect the log to see if any warnings or errors pop up when you try to fire

And indeed I also needed NetUseOwnerRelevancy on the child actor

Clients can spawn things locally but they won’t be able to replicate. It is possible that you created two instances (1 Replicated by the Server and 1 local)or one of them was never spawned because it collided with the other.