We have had a problem where unreal locks up on load (after working in a session where everything worked), and have tracked it down. This is a serious issue because you lose all your work and have to revert back to the last time you made a backup to be able to fix anything. No log is produced in this case.
Our structure is that we have an OurGameModeCPP, with an OurGameModeBlueprint inherited from it for setting custom defaults in editor
We have a OurPlayerCharacterCPP, with an OurPlayerCharacterBlueprint inherited from it. OurPlayerCharacterBlueprint is the default pawn.
What we were finding is that if OurPlayerCharacterBlueprint (or any class that it contained a reference to) did a GetGameMode() into a Cast To OurGameModeblueprint, the editor would never load again (even if this cast was never executed). If we changed it to a Cast To OurGameModeCPP, there would be no problem.
We finally tracked down the problem to this code in the constructor of OurGameModeCPP:
static ConstructorHelpers::FClassFinder<APawn> PlayerPawnBPClass(TEXT("/Game/Blueprints/OurPlayerCharacterBlueprint"));
if (PlayerPawnBPClass.Class != NULL)
{
DefaultPawnClass = PlayerPawnBPClass.Class;
}
If we removed this code there was no longer a problem, even though this is how setting a default pawn class is done in Unreal CPP (I think many of the samples do this).
If I had to guess on the bug (here’s where I lose my cred), it’s that during the process of loading, the system loads in class definitions on demand.
OurGameModeBlueprint has a reference to OurGameModeCPP which then on construction has a reference to OurPlayerCharacterBlueprint class which refers to OurGameModeBlueprint again (because it contains the cast to OurGameModeBlueprint) which isn’t identified as being loaded, so it starts the cycle again. In general this reference stuff is robust, but something about child/parent classes mixing with c++/blueprint breaks it.
Anyways, if anyone else has this problem (I see several unanswered questions about this on the forums), our workaround is to put all the blueprint functionality in c++ and then always cast to the CPP class instead of the blueprint class. This has made things robust again.
-Michael