So I was tinkering around with ServerTravel and I understand from this piece of documentation that ServerTravel is to be called on the Server. Once it is called, it then calls ClientTravel to all the connected PlayerControllers so that the clients come along as well. The issue is that when I call Servertravel, the Server will travel to the new level but the client remains in the previous level. Can anyone explain why?
Here’s my code:
MyPlayerController.cpp
void AMyPlayerController::BeginPlay()
{
Super::BeginPlay();
GetWorld()->GetTimerManager().SetTimer(TestTimerHandle, this, &AMyPlayerController::LoadIntoLevel, 3.0, false);
}
void AMyPlayerController::LoadIntoLevel()
{
UWorld* World = GetWorld();
if (World)
{
if (Role == ROLE_Authority)
{
World->ServerTravel("/Game/Levels/Test");
}
}
}
I did that through Blueprints already. Both are in the same session which is why I’m so confused as to why the client won’t follow along. Do you want me to show the Blueprints and see if they can help explain?
Well I feel incredibly dumb. I just realized I wan’t launching my game from the main menu so there wasn’t a session that the two game windows joined in the first place.