Download

Cast To GameHUD

So, I have followed this](htthttps://docs.unrealengine.com/latest/INT/Engine/UMG/QuickStart/4/index.htmlp://) tutorial to the “T” under the sections “Dislaying the HUD” It is spelled wrong in the tutorial… this might be a bad omen… For some reason I can’t Cast To GameHUD… please help :frowning: I have tried every node toggling context box on and off and still cant seem to cast to GameHUD… I have done EVERYTHING exactly and nada :frowning:

Thanks!
Sorry If this has been an issue but I can’t find anything on Cast To GameHUD

You might want to follow all the other parts previous to the the part you have followed.

Here’s the start of the full tutorial: UMG HUD TUTORIAL

When you’re creating your widget, store it in a variable. You should be able to do a GetNode on the variable, and cast it. Try toggling the Context Sensitivity.

I started from the very beginning of the tutorial, I just posted the link to the current part i was stuck on, I deleted my progress and started over several times and I still am getting no Cast to GameHUD… BLARG!!!

I did this as well The GameHUDWidget variable… from the Promote To Variable function, I think that’s what that was, I’m a noob :smiley:

Promote to Variable is the same as creating a variable, it just automates the process :wink: As I asked in the private message, can you upload a screenshot to the thread?

I had the very same issue yesterday and it nearly drove me insane, but I found a solution: If I compiled and saved all my blueprints, closed them all, then re-opened then it worked.

lol i did this too :frowning:

I tried this again and even shut down the editor… nothing :frowning:

I remade what you showed. It works fine for me.

You could try deleting your Intermediate folder, the engine will rebuild it all again.

deleting that didn’t work either… this is incredibly odd… I must have some obscure UMG feature turned off…

I did what you suggested in the private message, deleted and created one (GameHUDWidget variable) from scratch… and it WORKED :smiley: :smiley: :smiley: :smiley: :smiley: Thank you so much Neur0t1c, and thanks for all your other suggestions. I will never promote to variable again… lol jk im sure its just broken

I ran into the exact same problem yesterday, funny to read I’m not the only one. I will try the suggestions mentioned here tonight!

Why are you casting that to begin with? Create that widget should already be of that type there shouldn’t be a need to cast.

[COLOR="#FF0000"]I was following this tutorial[/COLOR]

In this section

This is where the evil happens

I created the variable from scratch like Neur0t1c suggested. Thanks again!

What I am saying is there is no reason to cast to that, it’s already what you are casting it to. Those directions are just incorrect.

What you want to do is super simple, take those directions to no. 3. Then after 3 drag off the return value of the createwidget node and drag it to the Set MaxAmmo, then add the createdwidget to viewport. You will not need to cast at all here.

Ahhhhh I see, I am learning this as I go along so I am not able to determine at the moment what is the right way or not, so thank you very much for revealing an easier more proper way. Unless there is some hidden/unknown reason why the instructor did it the way that they did. :smiley:

Or if you want to still have that variable, you can always simply do the promote to variable and then do things directly from that rather than casting first. My guess is that the tutorial was from an earlier version where creating the widget made a general user object so you had to cast to get the correct one you wanted. But with how it works now that isn’t needed.

I know this is already mentioned but yeah - casting to in the old docs is old hat. It was part of the (essentially) beta release and changed. The docs are getting worked on from what I’ve heard.

I have had to redo nodes a few times though btw, it seems to mainly come from me copying and pasting stuff but could be other things too…