# A strange problem  about the UMG module

**URL:** <https://forums.unrealengine.com/t/a-strange-problem-about-the-umg-module/739876>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine, module, Widget, question, CPP\
**Created:** [January 1, 2023, 2:02pm UTC](https://forums.unrealengine.com/t/a-strange-problem-about-the-umg-module/739876 "2023-01-01T14:02:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cchen771](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Cchen771](https://forums.unrealengine.com/u/Cchen771)\
**Post date:** [January 1, 2023, 2:02pm UTC](https://forums.unrealengine.com/t/a-strange-problem-about-the-umg-module/739876/1 "2023-01-01T14:02:09Z")

</div>

At first sorry for my bad English.  
I create a C++ HUD class like this

```auto
// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/HUD.h"
#include "MyHUD.generated.h"

class UUserWidget;
UCLASS()
class NETWORKTESTPROJECT_API AMyHUD : public AHUD
{
	GENERATED_BODY()
protected:
	UPROPERTY(EditDefaultsOnly,BlueprintReadOnly,Category="Widgets")
	TSubclassOf<UUserWidget> UserWidgetClass;
	UUserWidget* UserWidget = nullptr;

};

```

It cause Link Error.And I search online and find that i need to include UMG module to fix it.  
I have similar code in my last project and I never include the UMG module but my last project works well.  
And I finnaly found that if you create a subclass of UUserwidget like

```auto
#pragma once
#include "CoreMinimal.h"
#include "Blueprint/UserWidget.h"
#include "MyUserWidget.generated.h"
UCLASS()
class NETWORKTESTPROJECT_API UMyUserWidget : public UUserWidget
{
	GENERATED_BODY()
	
};

```

You do not need include UMG module but work well!  
WHY??
