Description

Randomly selecting a character class from the GameMode constructor using ConstructorHelpers::FClassFinder can result in default or null character being set when the level is reloaded. It appears that FClassFinder is not calling AddToRoot(). This only seems to be a problem with non-Editor versions of the project.

Shelved CL 2743610 looks like it may correct the issue.

Steps to Reproduce
  1. Unzip the attached TestConstHelper project.
  2. Generate Visual Studio project files.
  3. Build the project in Visual Studio (Development Editor - Win64).
  4. Open the project in the Editor.
  5. Cook content for Windows.
  6. Close the Editor.
  7. Start a new debug instance in Visual Studio (Development - Win64).
    • The game will start in a new window. When the level loads, a number between 0 and 2 will be displayed in the top left corner indicating which of the 3 character blueprints was randomly selected.
  8. Press the P key to reload the level.
    • The number in the top left corner may be different.
  9. Continue to press the P key several more times.

RESULT:
The game will eventually hit a breakpoint when reloading the level.

EXPECTED:
The game continues reloading the level successfully.

Callstack

TestConstHelper.exe!AGameMode::ChoosePlayerStart_Implementation(AController * Player) Line 1446 C++
TestConstHelper.exe!AGameMode::execChoosePlayerStart(FFrame & Stack, void * const Z_Param__Result) Line 67 C++
TestConstHelper.exe!UFunction::Invoke(UObject * Obj, FFrame & Stack, void * const Z_Param__Result) Line 4457 C++
TestConstHelper.exe!UObject::ProcessEvent(UFunction * Function, void * Parms) Line 1118 C++
TestConstHelper.exe!AActor::ProcessEvent(UFunction * Function, void * Parameters) Line 601 C++
TestConstHelper.exe!AGameMode::ChoosePlayerStart(AController * Player) Line 4650 C++
TestConstHelper.exe!AGameMode::FindPlayerStart_Implementation(AController * Player, const FString & IncomingName) Line 388 C++
TestConstHelper.exe!AGameMode::execFindPlayerStart(FFrame & Stack, void * const Z_Param__Result) Line 67 C++
TestConstHelper.exe!UFunction::Invoke(UObject * Obj, FFrame & Stack, void * const Z_Param__Result) Line 4457 C++
TestConstHelper.exe!UObject::ProcessEvent(UFunction * Function, void * Parms) Line 1118 C++
TestConstHelper.exe!AActor::ProcessEvent(UFunction * Function, void * Parameters) Line 601 C++
TestConstHelper.exe!AGameMode::FindPlayerStart(AController * Player, const FString & IncomingName) Line 4658 C++
TestConstHelper.exe!AGameMode::InitNewPlayer(APlayerController * NewPlayerController, const TSharedPtr<FUniqueNetId const ,0> & UniqueId, const FString & Options, const FString & Portal) Line 1025 C++
TestConstHelper.exe!AGameMode::Login(UPlayer * NewPlayer, ENetRole RemoteRole, const FString & Portal, const FString & Options, const TSharedPtr<FUniqueNetId const ,0> & UniqueId, FString & ErrorMessage) Line 1066 C++
TestConstHelper.exe!UWorld::SpawnPlayActor(UPlayer * NewPlayer, ENetRole RemoteRole, const FURL & InURL, const TSharedPtr<FUniqueNetId const ,0> & UniqueId, FString & Error, unsigned char InNetPlayerIndex) Line 656 C++
TestConstHelper.exe!ULocalPlayer::SpawnPlayActor(const FString & URL, FString & OutError, UWorld * InWorld) Line 234 C++
TestConstHelper.exe!UEngine::LoadMap(FWorldContext & WorldContext, FURL URL, UPendingNetGame * Pending, FString & Error) Line 9665 C++
TestConstHelper.exe!UEngine::Browse(FWorldContext & WorldContext, FURL URL, FString & Error) Line 8781 C++
TestConstHelper.exe!UEngine::TickWorldTravel(FWorldContext & Context, float DeltaSeconds) Line 8956 C++
TestConstHelper.exe!UGameEngine::Tick(float DeltaSeconds, bool bIdleMode) Line 943 C++
TestConstHelper.exe!FEngineLoop::Tick() Line 2626 C++
TestConstHelper.exe!GuardedMain(const wchar_t * CmdLine, HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, int nCmdShow) Line 142 C++
TestConstHelper.exe!WinMain(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * __formal, int nCmdShow) Line 189 C++

Have Comments or More Details?

Head over to the existing Questions & Answers thread and let us know what's up.

0
Login to Vote

Fixed
ComponentUE - Gameplay
Affects Versions4.9.24.11
Target Fix4.10
Fix Commit2727968
Main Commit2728573
Release Commit2744719
CreatedOct 27, 2015
ResolvedOct 28, 2015
UpdatedApr 27, 2018