diff --git a/AdvancedSessions/Source/AdvancedSessions/Classes/AdvancedSessionsLibrary.h b/AdvancedSessions/Source/AdvancedSessions/Classes/AdvancedSessionsLibrary.h index 386900a..54153ae 100644 --- a/AdvancedSessions/Source/AdvancedSessions/Classes/AdvancedSessionsLibrary.h +++ b/AdvancedSessions/Source/AdvancedSessions/Classes/AdvancedSessionsLibrary.h @@ -200,5 +200,10 @@ public: UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|Misc") static bool HasOnlineSubsystem(FName SubSystemName); + //**** Seamless travel Functions ****// + + //Exposes Server travel to blueprint + UFUNCTION(BlueprintCallable, BlueprintAuthorityOnly, Category = "Online|AdvancedSessions|Seamless", meta = (HidePin = "WorldContextObject", DefaultToSelf = "WorldContextObject")) + static bool ServerTravel(UObject* WorldContextObject, const FString& InURL, bool bAbsolute, bool bShouldSkipGameNotify); }; diff --git a/AdvancedSessions/Source/AdvancedSessions/Private/AdvancedSessionsLibrary.cpp b/AdvancedSessions/Source/AdvancedSessions/Private/AdvancedSessionsLibrary.cpp index feca4e3..218eabd 100644 --- a/AdvancedSessions/Source/AdvancedSessions/Private/AdvancedSessionsLibrary.cpp +++ b/AdvancedSessions/Source/AdvancedSessions/Private/AdvancedSessionsLibrary.cpp @@ -528,3 +528,21 @@ void UAdvancedSessionsLibrary::GetNumberOfNetworkPlayers(UObject* WorldContextOb 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) + { + World->ServerTravel(FURL, bAbsolute, bShouldSkipGameNotify); + return true; + } + + return false; +} \ No newline at end of file