Hey Guys!
I just got level transitioning working but when i set player name in main menu, and then go to lobby, the players name (which i try to store in a custom player controller), is not the same in the transitional level. I read through GameMode.h and found what i thought would be useful methods to override, but it seems like my playercontroller pointer is not the same during the first travel, but IS the same on the second travel.
Pretty simple, and i have poured over the documentation, but cannot seem to make it work.
ABotBattleGameMode_Menu::ABotBattleGameMode_Menu(const class FObjectInitializer& PCIP)
: Super(PCIP)
{
PlayerControllerClass = ABotBattlePlayerController::StaticClass();
bUseSeamlessTravel = true;
}
void ABotBattleGameMode_Menu::travelToLoadingScreen() {
FString url = "/Game/Maps/LoadingScreen";
ABotBattlePlayerController* c = (ABotBattlePlayerController*)GWorld->GetFirstPlayerController();
SCREEN(FColor::Green, "CEEEE %p", c)
SCREEN(FColor::Green, "Player joined: %s", *(c->BotName))
GWorld->ServerTravel(url);
}
ALoadingScreenGameMode::ALoadingScreenGameMode(const class FObjectInitializer& PCIP)
: Super(PCIP)
{
PlayerControllerClass = ABotBattlePlayerController::StaticClass();
bUseSeamlessTravel = true;
}
void ALoadingScreenGameMode::travelToLobbyScreen() {
FString url = "/Game/Maps/Lobby";
GWorld->ServerTravel(url);
}
void ALoadingScreenGameMode::HandleSeamlessTravelPlayer(AController*& c) {
SCREEN(FColor::Red, "CEEEE %p", &c)
Super::HandleSeamlessTravelPlayer(c);
SCREEN(FColor::Red, "CEEEE2222 %p", &c)
ABotBattlePlayerController* player = (ABotBattlePlayerController*)&c;
SCREEN(FColor::Red, "Player joined: %s", *(player->BotName))
}