[BP] PlayerState gets spawned when Player leaves

Cedric Neukirchen
Sat, 09 May 2015 23:40:21 +0000
Multiplayer & Networking

Hey there,

i hope that this is NOT a bug, but i have no idea where it comes from.

I have my Lobby setup where a Player Hosts a Game as a listen Server and Clients can connect.
This is all running well. My PlayerState tells GameState on joining (BeginPlay), that he wants to be added to one of Team Arrays. Also working.

This is only place where i call function to add Player to a team!

Now, when i leave lobby by either closing game, going back to main menu or kicking player, Player tells Server to get rid of him (deleting him from arrays). Also working.

BUT THEN a new PlayerState gets spawned ON SERVER SIDE although player left.

How do i know this? Because function gets called although no new PlayerState should be created.
one of leaving player got destroyed (variables were reseted and player vanished from list).

But then from no where, server spawns a fresh PlayerState, and PState adds himself to array (BeginPlay like i said) and i have a ghost Player.

Is this normal? When i rejoin and look into scene outliner, i have more and more PlayerStates. PlayerArray of GameState shows correct amount of PlayerStates, but in debuggin area of Blueprint etc, i can clearly see another PlayerState. And this happens for every extra client that connects and leaves.

Weird thing is. If i reconnect, PlayerState does not remain in lobby. I only got clients one then.

I have no idea if i can recreate this in a fresh project an it is already 01:39 in germany. I will get some sleep and try this tomorrow. Otherwise i would love to send one of Staff people my project in private to have a look at it.

15 posts - 5 participants