SetPlayerName bug upgrade from 4.12 to 4.15

Hi ,

thanks for your reply. I’ll try to reproduce the bug with a clean installation.

Here’s my GameMode code :

AActor* ATopDownGameMode::ChoosePlayerStart_Implementation(AController *Player)
{
	if (Player != nullptr)
	{ 
		AArenaPlayerState* cps = Cast<AArenaPlayerState>(Player->PlayerState);
		AArenaGameState* cgs = Cast<AArenaGameState>(Player->GetWorld()->GetGameState());
		FString PlayerName;
		//ajoute au bon tableau un nouveau joueur
		if (cgs->TTeams[0]->PlayerStates.Num() == cgs->TTeams[1]->PlayerStates.Num()) //ajoute à l'équipe bleu
		{
			cgs->TTeams[0]->PlayerStates.Add(cps);
			PlayerName = FString::FromInt(cgs->TTeams[0]->PlayerStates.Num());
			PlayerName.Append(TEXT("Blue"));
			//cps->Spawn(PlayerName, 0, cgs->TTeams[0]->PlayerStates.Num() - 1, cgs->TTeams[0]->PlayerStates.Num() - 1);
			cps->Spawn(PlayerName, 0, cgs->TTeams[0]->PlayerStates.Num() - 1, 0);
			if (cgs->TTeams[0]->PlayerStates.Num() > MinTeamPlayers) cps->State = EStateEnum::Playing;
			for (TActorIterator<APlayerStart> ActorItr(GetWorld()); ActorItr; ++ActorItr)
			{
				// Same as with the Object Iterator, access the subclass instance with the * or -> operators.
				APlayerStart *Mesh = *ActorItr;
				if (GEngine)
				{
					//GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Blue, FString::SanitizeFloat(cgs->TTeams[0]->PlayerStates[cgs->TTeams[0]->PlayerStates.Num()-1]->GetHealth()));
				}
				if (ActorItr->GetName() == TEXT("SpawnTeamBlue"))
				{ 
					return Mesh;
				}
			}
		}
	}
	return nullptr;
}

SetPlayerName is called in the cps->Spawn function :

void AArenaPlayerState::Spawn(FString Name, int Team, int TeamPosition, uint8 EClass)
{
	SetPlayerName(Name);
	this->Team = Team;
	this->TeamPosition = TeamPosition;
	this->EClass = (EClassEnum)EClass;
}

Thanks for helping.