ServerTravel crashes when called in the Play In Editor mode. However, for a packaged build it seems to work just fine. Since I am absolutely new to Unreal Engine, I might do something completely wrong that just happens to work for packaged builds.
Here’s what I did:
-
Created a new project based on the C++ “ThirdPerson” template
-
I added a second level
/Game/ThirdPerson/Maps/SecondMap
-
I added a third level that I configured in the
Project Settings
to be theTransition Map
(not sure if this was required) -
I exposed
ServerTravel
by creating aUBlueprintFunctionLibrary
for it:void UMyBpLibrary::ServerTravel(UObject* WorldContextObject, const FString URL, bool bAbsolute, bool bShouldSkipGameNotify)
{
UWorld* World = WorldContextObject->GetWorld();
AGameMode* mode = World->GetAuthGameMode();
if (mode != nullptr)
{
World->ServerTravel(URL, bAbsolute, bShouldSkipGameNotify);
}
} -
In my
AGameMode
I setbUseSeamlessTravel = true;
in the constructor. -
In the default level blueprint I made the
T
key change the level:
-
Finally I made a packaged development build and ran the server and client as:
MyProject.exe ?listen
MyProject.exe 127.0.0.1
The packaged development build works fine; both players start in the same level and are transferred to the new map (via the configured transition map). However, if I start to play in editor with 2 players and press T
, I get an access violation.
This is the call stack:
UE4Editor-Engine.dll!UActorChannel::CleanUp(const bool bForDestroy) Line 1443 C++
UE4Editor-Engine.dll!UChannel::ReceivedSequencedBunch(FInBunch & Bunch) Line 279
UE4Editor-Engine.dll!UChannel::ReceivedNextBunch(FInBunch & Bunch, bool & bOutSkipAck) Line 588
UE4Editor-Engine.dll!UChannel::ReceivedRawBunch(FInBunch & Bunch, bool & bOutSkipAck) Line 344
UE4Editor-Engine.dll!UNetConnection::ReceivedPacket(FBitReader & Reader) Line 979
UE4Editor-Engine.dll!UNetConnection::ReceivedRawPacket(void * InData, int Count) Line 457
UE4Editor-OnlineSubsystemUtils.dll!UIpNetDriver::TickDispatch(float DeltaTime) Line 174
UE4Editor-Engine.dll!TBaseUObjectMethodDelegateInstance<0,UNetDriver,void __cdecl(float)>::ExecuteIfSafe(float ) Line 772
UE4Editor-Engine.dll!TBaseMulticastDelegate::Broadcast(float ) Line 1030
UE4Editor-Engine.dll!UWorld::Tick(ELevelTick TickType, float DeltaSeconds) Line 1027
UE4Editor-UnrealEd.dll!UEditorEngine::Tick(float DeltaSeconds, bool bIdleMode) Line 1329
UE4Editor-UnrealEd.dll!UUnrealEdEngine::Tick(float DeltaSeconds, bool bIdleMode) Line 347
UE4Editor.exe!FEngineLoop::Tick() Line 2257
UE4Editor.exe!GuardedMain(const wchar_t * CmdLine, HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, int nCmdShow) Line 142
UE4Editor.exe!WinMain(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * __formal, int nCmdShow) Line 191
I’m probably reading it wrong, but it looks like the line where it crashes just sets the RF_PendingKill
flag that is already set through the call on the line above it (which seems to end up in UActorComponent::DestroyComponent).
Please let me know whether I am using ServerTravel
in the wrong context or that this is a valid bug report. I am using version 4.7.4-2497108+++depot+UE4-Releases+4.7 on Windows.