PreClientTravel not being called when travelling

I am trying to do some cleaning before ClientTravel is called since for some reason the client crashes if its pawn is still there when ServerTravel is being called. Looking at the documentation and the APlayerController.h header file, there is this function PreClientTravel which should be called before any travelling takes place. Thing is in my case it is not being called at all. I added debug messages to it and they are not displayed in the client. nor they appear in the logs.

So anyone has any idea why this function would not be called? Do I have to call it myself? BTW, I use seamless travel, in case this might have something to do with this issue.

My PreClientTravel:

void AECOBasePlayerController::PreClientTravel(const FString & PendingURL, ETravelType TravelType, bool bIsSeamlessTravel)
    	UE_LOG(LogTemp, Warning, TEXT("PreClientTravel was called."))
    	GEngine->AddOnScreenDebugMessage(-1, 10.f, FColor::Red, TEXT("PreClientTravel was called."));

            /// Get the possessed pawn
    	APawn* ECOPawn = AController::GetPawn();

    	/// Only if we have a possessed pawn do we attemp to destroy it before travelling
    	if (bIsInLobby)
        	if (ECOPawn)
	        	UE_LOG(LogTemp, Warning, TEXT("Possessed pawn is not nullptr"))
         		GEngine->AddOnScreenDebugMessage(-1, 10.f, FColor::Red, TEXT("Possessed pawn is not nullptr"));
        	bIsInLobby = false;

Not completely sure if this could be the reason but I did notice you are not calling Super::PreClientTravel(PendingURL, TravelType, bIsSeamlessTravel); Change that and see if it gets called.

Thanks for the answer. The crash that is happening is the problem in this case, it seems. Looking into the source code for AGameMode and APlayerController, this function should be called regardless as it is the first thing called when ProcessClientTravel is called on a PC. The presence of the Pawn seems to be making it crash before event ClientTravel is even called.

It is… funky. But again, Thanks! :smiley: