I have run into many problems when trying to use this code. First, I have an incomplete type error on my UUserWidget. Second, this incomplete type error cascades down throughout my code. I have tried to find any workarounds but I have not found any. I need to find a workaround for the UUserWidget problem.
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "Runtime/UMG/Public/Blueprint/UserWidget.h"
#include "MainMenuBP.generated.h"
/**
*
*/
UCLASS()
class MAINMENUCODE_API UMainMenuBP : public UUserWidget
{
GENERATED_BODY()
public:
UMainMenuBP(const FObjectInitializer& ObjectInitializer);
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = MainMenu)
TSubclassOf<UUserWidget> WidgetTemplate;
UPROPERTY()
UUserWidget* WidgetInstance;
};
The error is found in the first line of the class.
class MAINMENUCODE_API UMainMenuBP : public UUserWidget
“IncompleteType” errors mean you’re forward declaring a class and the compiler needs the class’s full definition. In this case, a header you’re including is likely forward declaring a class.
I had a similar problem with UUserWidget and just added all of these includes:
I fixed it. The answer was that initially when I created the class I used something other than UserWidget to automatically create the class. I guess when the class got automatically created that more was going on behind the scenes than anticipated. Once I created a new class with a UserWidget as the class then all the problems disappeared. Once again, I would like to thank you guys for the quick response and thank you for the help.