Handling a client disconnect


I’m having trouble finding a proper way of removing the pawn of client, when the client has disconnected or timed out. I’ve looked into using events such as EventNetworkError, however it doesn’t come back with any information regarding who was disconnected.

Any ideas?



  1. Create your own GamePlayerController class which derives from PlayerController.
  2. Event BeginPlay is where you can assume that a new player starts playing, and together with a check for “Is Server”, you are sure that a new player logs on to the server (either the local player, or a remote player)
  3. If on the server, you can spawn your pawn (if no default pawn is set), then the newly spawned pawn should be replicated to the client (but of course without a remote player controller on the non-owning client) - note: you don’t necessarily need to possess the pawn depending on your game logic! (e.g. you can have the pawn be “owned” by the spawning player controller, but use an AIController to actually control its behavior)
  4. Event EndPlay is where you can assume that the player is gone; again, if on the server (“Is Server”), then you can safely destroy the currently owned pawns.
1 Like