Developer Notes

This is a deadlock caused by re-entry of the constructor which is initialising the static. The native AMyGameMode class load the character blueprint which has the same native AMyGameMode class as its export so AMyGameMode's CDO needs to be constructed on load which leads to a dead-lock caused by internal C++ guard on static local variables.

There's no way around it in UE4. The native AMyGameMode class load the character blueprint which has the same native AMyGameMode class as its export so AMyGameMode's CDO needs to be constructed on load which leads to a dead-lock caused by internal C++ guard on static local variables.

Description

When a GameMode class defines the default pawn class as a character blueprint, and the character blueprint contains a cast node to a blueprint based on the GameMode class, the project will freeze between 70%-73% on load. This occurs even if the cast node is not connected to any execution path.

This is inconsistent with using a cast node to the GameMode class directly which will load fully and launch the editor.

Steps to Reproduce
  1. Download Attached project
  2. Launch .uproject
    • Project will load fully
  3. Close the editor and open .sln file
  4. Uncomment AMyGameMode constructor
  5. Compile
  6. Launch .uproject again

Result:
Project gets to 71% - 73% and then stops loading. UE4Editor must be closed from Task Manager

Expected:
Project loads and editor opens

Have Comments or More Details?

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

3
Login to Vote

Won't Fix
ComponentUE - Foundation - Core
Affects Versions4.13.24.14
Target Fix4.16
CreatedOct 27, 2016
ResolvedApr 12, 2017
UpdatedApr 27, 2018