Multiplayer actor spawn twice on client

Hello, when spawn actor on client, i`m using dedicated server, actor spawn twice. Help solve this problem

Hello @Bagby_NK

Welcome back to the forums! I took a look around in regards to the issue that you’re experience with the duplicate actor spawns. I pulled a post from an older thread that I think may be of use with this. Here is the post. I hope that this is helpful! If not, respond back and we can check some other fixes.

This answer does not solve the problem, i`m using UE 5.1

Multiplayer actors need to be spawned by the Authoritative Proxy… aka the servers copy of your character.

Some action that’s going to spawn the actor → Switch has Authority[AUTH]: Spawn Actor.

OR

Input pressed → Switch has Authority[Remote] → RPC_SERVER_SPAWN

RPC_Server_Spawn → Spawn Actor

This is my PC and GM

Your player/pawn class most likely replicates itself already, so you don’t need a Multicast to spawn it everywhere. Just spawn it on server-side, and it will replicate to everyone.

In your PC class, simply remove replication from the “SpawnPlayer” event. The rest looks fine.

You should also remove replication from GameMode’s “SpawnPlayer” event as it has absolutely no effect.

No… don´t use the Multicast.

In your Srv_SpawnPlayer, get the GameMode and Spawn the Player. Get rid of the whole SpawnPlayer Event.

Reason:
The GameMode is only existing on the ServerSide… so… if you Call this on a Multicast Event, it will redo the spawning for all Clients, for all Characters… so… twice…

You don´t need to multicast a Spawn via GameMode, cause a Server sided spawn is always replicated to all clients, without you need to do anything.

Thank you for your participation

PC


GM

Result


should be 2 cubes

I’ve been having the same issue where the client is seeing duplicates of a spawned actor, I did what you did here (begin play > switch has authority (remote) > custom event (executes on server) > spawn logic)

All of a sudden it spawns just 1 actor for the host and for the client… everything i thought i knew tells me I should have used Authority, not Remote… Can anyone explain why it only works when you call the custom server event from the remote switch?

It depends on which Proxy you want to execute the code.

If you want Players (Autonomous) or Copies of opponents/you (Sims) you use Remote.
If you want the Server to execute the code you use Authority.

So if you are running a switch has authority on Begin Play and you want the Server to do something when it spawns the actor… use Auth. Otherwise use remote for Autonomous and Simulated Proxy execution.

Double click the switch has authority node and it will open the macro. It’s literally just checking on who has network authority.

1 Like