Hello,
I’m having trouble setting up a basic “team selection menu” upon player connecting.
Here’s what I did:
First, I added [FONT=Courier New]bStartPlayersAsSpectators = true to my GameMode constructor. I learned that it isn’t working on Play-in-Editor. Not sure about listen servers. I filled a bug report here. I would love a temporary workaround for this.
Then I added a simple, two teams button widget blueprint.
After that, I tried to set it up with the code:
UUserWidget* WidgetInstance = CreateWidget<UUserWidget>(NewPlayer, TeamSelectionMenu);
if (WidgetInstance)
WidgetInstance->AddToViewport();
Initially, I thought it would be a good idea to add that to [FONT=Courier New]MyGameMode::StartNewPlayer(APlayerController* NewPlayer), but then I noticed that this runs only on the server (so it only appears on the listen server). I don’t want to make that run via blueprinting.
So, my issues are:
1st) Is there a workaround to make players spawn as spectators, even on listen servers? (BONUS: Be able to set the player location as soon as he spawns - thought I can probably move the player to a friendly “Player Start” once I get it working)
2nd) Where should I add that piece of code (or something similar) so that, once the player connects to the server or enter a new map, it creates and display the UMG widget, so the player can choose the team he will join?
Thank you in advance!