I have a Blueprint HUD…
WidgetBlueprint'/Game/UI/GameHUD.GameHUD'
And a C++ GameMode…
Class'/Script/Trek_On.Trek_OnGameMode'
The GameMode is as follows:
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "GameFramework/GameMode.h"
#include "Trek_OnGameMode.generated.h"
class AEnemy;
UCLASS()
class TREK_ON_API ATrek_OnGameMode : public AGameMode
{
GENERATED_BODY()
public:
// Constructor
ATrek_OnGameMode();
// Array of current enemies
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Enemies")
TArray<AEnemy *> Enemies;
};
And…
// Fill out your copyright notice in the Description page of Project Settings.
#include "Trek_On.h"
#include "Enterprise.h"
#include "Trek_OnGameMode.h"
#include "GameFramework/HUD.h"
ATrek_OnGameMode::ATrek_OnGameMode()
{
static ConstructorHelpers::FObjectFinder<UClass> HUDFinder(
TEXT("WidgetBlueprint'/Game/UI/GameHUD.GameHUD'"));
DefaultPawnClass = AEnterprise::StaticClass();
HUDClass = (UClass *) HUDFinder.Object;
}
I’m getting the following error and my HUD is not showing up.
Error: CDO Constructor (Trek_OnGameMode): Failed to find WidgetBlueprint'/Game/UI/GameHUD.GameHUD'
I’ve changed this line:
static ConstructorHelpers::FObjectFinder<UClass> HUDFinder(
TEXT("WidgetBlueprint'/Game/UI/GameHUD.GameHUD_C'"));
And I now no longer get the CDO error, but my HUD still isn’t showing up…