Description

During PIE instance initialization, there seems to be a window during which UWorld::GetNetMode will not return the expected value: before the instance's NetDriver has been created but after UGameInstance::StartPlayInEditorGameInstance calls UWorld::InitializeActorsForPlay. Because the Actors are initialized, the PlayInEditorNetMode will not be returned, but the URLNetMode retrieved from AttemptDeriveFromURL will still be NM_Standalone.

Steps to Reproduce

Start a PIE session using either the "Play as Listen Server" or "Play as Client" Net Mode.
Call UWorld::GetNetMode during the GameMode's InitGame function.
Expected: The world's NetMode would either be NM_ListenServer or NM_DedicatedServer depending on the Net Mode selected.
Actual: The world's NetMode will be NM_Standalone.

Lyra Repro:

  1. Open LyraGameMode.cpp and go to ALyraGameMode::InitGame
  2. Add this line of code after Super::InitGame: UE_LOG(LogTemp, Warning, TEXT("ALyraGameMode::InitGame Net Mode is %d"), (int32)GetNetMode());
  3. Compile and launch Lyra editor
  4. Open the expanse map using the button on the tool bar
  5. Change the Play in Editor settings to Client (and make sure it's set to play in one process)
  6. Hit Play to start the PIE session
  7. Look in the output log for the line "ALyraGameMode::InitGame Net Mode is " added above. If it reports 0 (standalone) this is still broken, if it reports 1 (dedicated server) this is fixed

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-174595 in the post.

0
Login to Vote

Fixed
ComponentUE - Networking
Target Fix5.3
Fix Commit24433305
Main Commit24433305
CreatedJan 19, 2023
ResolvedFeb 27, 2023
UpdatedMay 19, 2023
View Jira Issue