Added ServerTravel to library cpp

This commit is contained in:
uno1982
2022-03-10 20:34:11 -06:00
committed by GitHub
parent e9747ff440
commit 36cb58ea15

View File

@@ -528,3 +528,14 @@ void UAdvancedSessionsLibrary::GetNumberOfNetworkPlayers(UObject* WorldContextOb
NumNetPlayers = TheWorld->GetGameState()->PlayerArray.Num(); NumNetPlayers = TheWorld->GetGameState()->PlayerArray.Num();
} }
bool UAdvancedSessionsLibrary::ServerTravel(UObject* WorldContextObject, const FString& FURL, bool bAbsolute, bool bShouldSkipGameNotify)
{
if (!WorldContextObject) return false;
//using a context object to get the world
UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::ReturnNull);
if (!World) return false;
World->ServerTravel(FURL,bAbsolute,bShouldSkipGameNotify);
return true;
}