Enabling Event Driven Loader causes intermittent issues, disabling breaks TextRender in package

I have a game in the wild using 4.17.2 and I keep getting reports from users saying that the game won’t start. Basically the process starts but it hangs before the window appears. Basically the process starts but it hangs before the window appears. This issue is completely random and only affects some computers, some of the time. I haven’t been able to recreate it on any of my 3 computers. I’ve had reports of the issue disappearing suddenly and also appearing suddenly. This particular issue has been [documented over here][1] and it was suggested that I disable Event Driven Loading. This did seem fix the issue, at least for 1 person… however it also introduces 2 other MAJOR issues.

The first issue is that StaticLoadObject now causes a fatal error at runtime. I’m using this function to load a map thumbnail (Texture2D) from user generated paks that are mounted at runtime. Obviously this is something that I can technically live without, so I just commented out the line and moved on.

The second issue, however, is much worse. TextRenders now seem to be failing to load fonts in the packaged build. UMG does not have any issues, but any and all TextRenderComponents and TextRenderActors in the game have become all squares:

https://i.imgur.com/UDMMwQj.png

The affected font is nothing special, just RobotoDistanceField. It works just fine in-editor, and this was absolutely not an issue before I disabled Event Driven Loading.

Obviously this is a deep rooted issue with the Event Driven Loader but I really can’t afford to wait for Epic to fix this issue. Is anyone aware of a workaround for this?

Update 10/14/2017 - 5:25pm

I listed the pak contents from my package and it does appear as though RobotoDistanceField is in there. This indicates an issue with the TextRenderComponent itself rather than the particular font.

Looking at TextRenderComponent.cpp, loading the default font seems to rely on ConstructorHelpers:

		// Structure to hold one-time initialization
		struct FConstructorStatics
		{
			ConstructorHelpers::FObjectFinderOptional<UFont> Font;
			ConstructorHelpers::FObjectFinderOptional<UMaterial> TextMaterial;
			FConstructorStatics()
				: Font(TEXT("/Engine/EngineFonts/RobotoDistanceField"))
				, TextMaterial(TEXT("/Engine/EngineMaterials/DefaultTextMaterialOpaque"))
			{
			}
		};
		static FConstructorStatics ConstructorStatics;

		{
			// Static used to watch for culture changes and update all live UTextRenderComponent components
			// In this constructor so that it has a known initialization order, and is only created when we need it
			static FTextRenderComponentCultureChangedFixUp TextRenderComponentCultureChangedFixUp;
		}

		PrimaryComponentTick.bCanEverTick = false;
		bTickInEditor = false;

		Text = LOCTEXT("DefaultText", "Text");

		Font = ConstructorStatics.Font.Get();

Update 10/14/2017 - 5:53pm

Copied RobotoDistanceField to my content folder and redirected all TextRenderActors to the new font so as to work around the constructor logic. Now the font does seem to display, but it is extremely large.

Update 10/16/2017 - 4:30pm

I’ve determined that the issue for TextRenderActors is that for whatever reason, in a packaged build with event driven loading off, InvDefaultSize does not get set correctly and ends up being 1.0f when it should be around 0.03f. This value is set in TextRenderComponent::SetFont(…) and is used to calculate bounds for the text. I’ve managed to find a workaround for this, which I will post below. I still have an issue, however, with TextRenderComponents on my character. These ones are rendered incredibly tiny:

The difference between this component and one in a TextRenderActor, presumably, is that I’m setting the components scale directly instead of using the world size field. I have already confirmed that InvDefaultSize is set correctly for these components.

I’ve determined that the issue for TextRenderActors is that for whatever reason, in a packaged build with event driven loading off, InvDefaultSize does not get set correctly and ends up being 1.0f when it should be around 0.03f. This value is set in TextRenderComponent::SetFont(…) and is used to calculate bounds for the text. My workaround is as follows:

void UProxyWarGameInstance::OnPostLoadMapWithWorld(UWorld* World)
{	
	// fix all text render actors [4.17.2 - Event Driven Loader disabled
	TArray<AActor*> TextRenders;
	UGameplayStatics::GetAllActorsOfClass(GetWorld(), ATextRenderActor::StaticClass(), TextRenders);

	for (int i = 0; i < TextRenders.Num(); i++) {
		if (ATextRenderActor* TextRender = Cast<ATextRenderActor>(TextRenders[i])) {
			if (UTextRenderComponent* TRComp = TextRender->GetTextRender()) {
				if (TRComp->Font) {
					TRComp->SetFont(TRComp->Font);
				}
			}
		}
	}
}

Basically it just calls SetFont on every TextRenderActor when a map loads, forcing InvDefaultSize to be recalculated.