# Why have a HUD class?

**URL:** <https://forums.unrealengine.com/t/why-have-a-hud-class/55660>\
**Category:** C++\
**Tags:** unreal-engine\
**Created:** [February 17, 2016, 11:33am UTC](https://forums.unrealengine.com/t/why-have-a-hud-class/55660 "2016-02-17T11:33:23Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Moynzy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Moynzy](https://forums.unrealengine.com/u/Moynzy)\
**Post date:** [February 17, 2016, 11:33am UTC](https://forums.unrealengine.com/t/why-have-a-hud-class/55660/1 "2016-02-17T11:33:23Z")

</div>

Hello,

I have created a main menu system in the past by using the UMG UI Designer,

I am now trying to code a HUD in UE4,

My question is, do I make a HUD class, or a Canvas class, or Widget Class?

The tutorials on-line do not go in depth, especially the UE4 one. I have searched the heavens and no good sources.

If I am to program my own user interface, how do I start, I am confused because of the Canvas, UMG, Slate, Widget etc.

---

<div class="post-metadata">

**Author:** ![Yata](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Yata](https://forums.unrealengine.com/u/Yata)\
**Post date:** [February 17, 2016, 1:16pm UTC](https://forums.unrealengine.com/t/why-have-a-hud-class/55660/2 "2016-02-17T13:16:31Z")

</div>

HUD is not UI class, it is for storing player parameters… or preparing them for UI, i think.  
I still not get the idea of HUD class myself. But the UI HUD i personally do using UMG, I think it is most preferred way now.

---

<div class="post-metadata">

**Author:** ![LuLima](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@LuLima](https://forums.unrealengine.com/u/LuLima)\
**Post date:** [February 17, 2016, 5:10pm UTC](https://forums.unrealengine.com/t/why-have-a-hud-class/55660/3 "2016-02-17T17:10:53Z")

</div>

I Believe that the hud class server as an intermediate between pawn/controller to the actual Widget. It stores the variables, states and take care of all of that logic. At least that how i see it

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_f54268a3](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_f54268a3](https://forums.unrealengine.com/u/anonymous_user_f54268a3)\
**Post date:** [February 18, 2016, 4:40pm UTC](https://forums.unrealengine.com/t/why-have-a-hud-class/55660/4 "2016-02-18T16:40:51Z")

</div>

I am using UMG for both HUD’s and Menu’s. They have been easy to work with. So, make a widget class. There’s a node, create widget where you can select your new widget class, then the node add to viewport. You can have more than one of them open at a time. So, while one of them can always be up, with health ammo etc. you can pop up others for say ingame pause menu, and remove it without interfering with your HUD widget.

---

<div class="post-metadata">

**Author:** ![eXi](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/exi/32/906583_2.png) [@eXi](https://forums.unrealengine.com/u/eXi)\
**Post date:** [February 19, 2016, 1:10am UTC](https://forums.unrealengine.com/t/why-have-a-hud-class/55660/5 "2016-02-19T01:10:09Z")

</div>

UMG wasn’t always there. Before you had the UMG Widget, we mainly used Slate and in BPs only the HUD Classes “Draw HUD” function.  
You can use that function to draw text and images on the screen by entering the exact pixel offset on the Screen etc.

Since UMG is available in BPs, the HUD class is mainly used to store the Widget and manage them, although widget don’t have to be in that  
HUD Class. I, for example, don’t use the HUD class at all.

---

<div class="post-metadata">

**Author:** ![msvcrt](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@msvcrt](https://forums.unrealengine.com/u/msvcrt)\
**Post date:** [February 19, 2016, 2:05am UTC](https://forums.unrealengine.com/t/why-have-a-hud-class/55660/6 "2016-02-19T02:05:48Z")

</div>

Another useful property of HUD is that in multiplayer games HUD objects only exist on clients. Local HUD objects may also exist on server if it is not dedicated. So HUD class can be used to store state and run behavior that only makes sense on client. This is usually UI-related stuff but it can be used for anything.

---

<div class="post-metadata">

**Author:** ![iniside](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/iniside/32/866315_2.png) [@iniside](https://forums.unrealengine.com/u/iniside)\
**Post date:** [February 19, 2016, 6:11am UTC](https://forums.unrealengine.com/t/why-have-a-hud-class/55660/7 "2016-02-19T06:11:30Z")

</div>

Legacy code, which gives you access to canvas drawing. It doesn’t really serve any purpose beyond that.

---

<div class="post-metadata">

**Author:** ![sivan](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@sivan](https://forums.unrealengine.com/u/sivan)\
**Post date:** [February 19, 2016, 7:51am UTC](https://forums.unrealengine.com/t/why-have-a-hud-class/55660/8 "2016-02-19T07:51:17Z")

</div>

I use HUD class for displaying debugging info in an organized and easy manner: a dark background panel (by DrawRect()) and a lot of variables with a short description (by DrawText()), I need it to check several variables of the actual state of my custom pathfinder and AI system.

---

<div class="post-metadata">

**Author:** ![R-Gard](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@R-Gard](https://forums.unrealengine.com/u/R-Gard)\
**Post date:** [October 12, 2018, 5:48pm UTC](https://forums.unrealengine.com/t/why-have-a-hud-class/55660/9 "2018-10-12T17:48:26Z")

</div>

I asked me the same question, i finally found this article, i share it here :

> **[User Interfaces & HUDs](https://docs.unrealengine.com/4.27/en-US/InteractiveExperiences/Framework/UIAndHUD/)**
>
> Guides and information for artists and programmers creating user interfaces such as menus and HUDs.

---

<div class="post-metadata">

**Author:** ![Shmoopy1701](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/shmoopy1701/32/1194536_2.png) [@Shmoopy1701](https://forums.unrealengine.com/u/Shmoopy1701)\
**Post date:** [October 15, 2018, 4:08pm UTC](https://forums.unrealengine.com/t/why-have-a-hud-class/55660/10 "2018-10-15T16:08:38Z")

</div>

HUD is still useful to set in your GameMode for throwing some simple debug text on screen. But yeah, C++ HUDWidget bypasses it completely now. Basically:

Game \>\> HUDWidget \>\> tell HUDBlueprint to do something

HUDBlueprint \>\> HUDWidget \>\> blueprint C++ callbacks

---

<div class="post-metadata">

**Author:** ![Shmoopy1701](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/shmoopy1701/32/1194536_2.png) [@Shmoopy1701](https://forums.unrealengine.com/u/Shmoopy1701)\
**Post date:** [October 15, 2018, 4:11pm UTC](https://forums.unrealengine.com/t/why-have-a-hud-class/55660/11 "2018-10-15T16:11:05Z")

</div>

Also, if you really dislike UMG you could write your own custom C++ UI using the base HUD class.
