# Casting to Hud not working

**URL:** <https://forums.unrealengine.com/t/casting-to-hud-not-working/425995>\
**Category:** UI\
**Tags:** hud, hud-class, unreal-engine, Widget, Blueprint, question\
**Created:** [May 26, 2018, 1:17pm UTC](https://forums.unrealengine.com/t/casting-to-hud-not-working/425995 "2018-05-26T13:17:42Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ELVEVERX](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ELVEVERX](https://forums.unrealengine.com/u/ELVEVERX)\
**Post date:** [May 26, 2018, 1:17pm UTC](https://forums.unrealengine.com/t/casting-to-hud-not-working/425995/1 "2018-05-26T13:17:42Z")

</div>

Hi,

I am trying to cast to my hud and execute a function in the hud to create a widget from my player, but it doesn’t seem to be working.

I am attempting to do it how it is explained here [https://answers.unrealengine.com/questions/595825/remove-widget-from-viewport.html](https://answers.unrealengine.com/questions/595825/remove-widget-from-viewport.html), but it is not working.

here are screen shots of my BP for the character

 ![242254-question.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/b/e/6befbd1c125babcb4038259b6bee0f3a1d230d46.png)

and here is the function i am trying to call

 ![242255-2.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/e/2/de249b506a69f123b4f38f07a6f7b255942239a6.png)

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [May 26, 2018, 2:22pm UTC](https://forums.unrealengine.com/t/casting-to-hud-not-working/425995/2 "2018-05-26T14:22:29Z")

</div>

Did you assign the HUD class in the Game Mode?

![242257-hud.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/0/a/40a621a6f9bfa78b80428872a944200b65bd0105.png)

---

<div class="post-metadata">

**Author:** ![Nebula\_Games\_Inc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Nebula\_Games\_Inc](https://forums.unrealengine.com/u/Nebula_Games_Inc)\
**Post date:** [May 26, 2018, 5:40pm UTC](https://forums.unrealengine.com/t/casting-to-hud-not-working/425995/3 "2018-05-26T17:40:56Z")

</div>

1. What is before the first screen shot? Is it just “begin play” or something like that?
2. Are you sure you are using a “HUD” class not a “widget” that you simply “called” a HUD?

---

<div class="post-metadata">

**Author:** ![ELVEVERX](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ELVEVERX](https://forums.unrealengine.com/u/ELVEVERX)\
**Post date:** [May 27, 2018, 1:23am UTC](https://forums.unrealengine.com/t/casting-to-hud-not-working/425995/4 "2018-05-27T01:23:19Z")

</div>

Yeah I did set the hud class

It’s set to the default firstpersonHUD from the first person project so that all seems right.

1. Yes, it is just after begin play
2. Its a HUD class it has the symbol with the plus and 5 boxes rather than the heart with two lines

---

<div class="post-metadata">

**Author:** ![ELVEVERX](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ELVEVERX](https://forums.unrealengine.com/u/ELVEVERX)\
**Post date:** [May 30, 2018, 12:59am UTC](https://forums.unrealengine.com/t/casting-to-hud-not-working/425995/5 "2018-05-30T00:59:42Z")

</div>

Sorry for wasting everyone’s time, I had stupidly tact it on to the end of other nodes in front of the begin play and didn’t realize the last part was conditional.
