Download

Preventing player spawn without a team

Hello :slight_smile:

I’m struggling with this for a while, so I decided to post it here.

The code I’m testing is based on Shooter Demo :slight_smile:
I have a small enum that determines the player team (Undefined, Team one, Team two) and, when the player joins the games, a UMG dialog pops up asking him/her for his/her team.

It works fine, except that the player is spawning as soon as it joins the game (spawning as undefined).

While I’ve set tons of breakpoints to find where the first player spawn happens, I couldn’t find it yet.

Any advice on how to prevent the player from spawning as soon as he/she connects? :slight_smile:

Thanks in advance!

if you have your default pawn class set to a character, the spawning is automatic. I think the only think you can do is not have a mesh assigned to the character then assign it once they pick a team, or not set a default pawn class, and somehow set it once they have selected a team.

Check this

Specifically:


void ASCoopGameMode::RestartPlayer(class AController* NewPlayer)