Assertion Failed when I want to load a HUD [UE 4.22]

Hello everyone,

When I play the level in the editor or as a standalone game I have no issue.
But when I launch it on Android or on my Windows PC I get this eror :

error.png

Here’s the line 2231 in the file AsyncLoading.cpp



// @todoio: why do we need this? some UFunctions have null outer in the linker.
if (Import->ClassName != NAME_Package && !bIsPrestreamRequest)
{
       check(0);
        continue;
}


It works fine when I set the build configuration to “DebugGame” (instead of Development or Shipping).

After I searched for the error I found out that it may have something to do with my HUD, here’s the code I used to load my HUD


FStringClassReference widgetClassRef(TEXT("/Game/GameHUD.GameHUD_C"));

if (UClass* widgetClass = widgetClassRef.TryLoadClass<UUserWidget>())
{
}


When I remove the if statement the error doesn’t show up anymore, but then I don’t have an HUD.
I don’t think the path is wrong, because it works when I play it in the editor, or when I launch it in “DebugGame”

My Blueprint HUD inherits from a C++ class containing a few BlueprintImplementableEvent and nothing else, like this:


UCLASS()
    class SPACESMTHING_API UGameHUD : public UUserWidget
    {
        GENERATED_BODY()

    public:
        UFUNCTION(BlueprintImplementableEvent)
        void LevelEnd(float hitScore, const FString& hitText, float landingScore, const FString& landingText, float finalScore);

        UFUNCTION(BlueprintImplementableEvent)
        void SetCurrentHit(int currentHit);

       ...

If needed, I can also share a screenshot of the Blueprint HUD, but it’s big and the entire blueprint doesn’t fit in a screenshot

How could I solve this issue?

Fixed the issue by removing the if statement in the file AsyncLoading.cpp :



if (Import->ClassName != NAME_Package && !bIsPrestreamRequest)
{    
check(0);    
continue;
} 

I still didn’t understood the purpose of this if statement, but I can launch it on Windows now without crash.