UMG Widget/HUD communication breakdown

No pun intended I cannot get my skydome, which has a “current minute” variable to set the sun and moons position and also lets me eventually concatenate a string together for hours minutes seconds, cannot be printed from a UMG widget created in a HUD BP, I’ve tried every method I’ve learnt from the UMG video, from templates from the offical tutorials on communication between blueprints and reading the documentation. I’ve been playing with it all day.

Heres the basic setup of my HUD (things such as static images show up fine, but I cant read variables from any BP in the level. In this example I get my “bad skydome cast” debug message. Displayed is my HUD class BP, my Skydome BP in the level, and the PIE view I get, static images, text, and buttons get displayed properly but variables are always “invisible”.

I was so excited a couple weeks ago when I found out I could use the canvas system for GUIs instead of just debug text and drawing textures or text with a HUD class, but displaying a variable just will not work period this direction. I have to go into my skydome, cast to the widget, set the text and that just seems backwards, I should be able to display the variables data on the GUI instead of setting the GUI in the BP that owns the variable I would think. Keep in mind I’m a C# programmer, it doesn’t allow for much data type casting.

TLDR: Do dynamic widgets IE a variable value being displayed in a text box have to be set from the BP the variable exists in? I cannot display a public variable from a BP in my level which is bound to a text block in a widget which is created in the HUD BP then added to viewport. This clutters my BP’s redicously, I’d like to have all my GUI stuff on my UMG class BPs and HUD class BPs

Maybe this is clearer. Here is my HUD blueprint. I get my debug “CANT MISS THIS CAST FAILED” messsage and the text block is blank, if I remove the wire to the “in text” it prints whatever string I type in there manually (abc123 for example) just fine.

In the first few pictures, you use a BP SkyDome Variable. Where do you actualy set this variable to the SkyDome actor? Because if you don’t do this, it will be NULL.

In the new picture, you are casting the Object you selected. But that is not the real actor. If you want to have the actor, you need to get it somehow.

Direct references are possible in the Level Blueprint. Otherwise you would want to make Interfaces for the Actors to set them selfs etc.

I set it by casting to the BP_Skydome blueprint then promoting the return as a variable so I can pull its variables out, exactly how I cast in the 2nd post. Same problem, just two differnt blueprints. Simple problem: trying to read a variable thats constantly changing (say a vehicles speed) in a widget class BP so that I can display it continuously (say as a speedometer reading) without having to go into the vehicle BP [in this example] and do the regular cast to HUD etc.

Does that make sense? I can make a short video. Basically I can display static things no problem with my HUD/UMG widget BP’s but I cant display a constantly changing value of a variable from an actor in my scene without having to edit the actors BP to do it the right way (like in vehicle template) I basicaly want to move the following stuff to a widget BP or part of the HUD bp so that I can allow my partner to work on the BP im taking the variables values from to build a GUI without making him stop work so I can edit the BP the following way…


There has to be an alternate method of displaying an actor’s variable directly 100% from within the widget or HUD class BP.

Solved. The submarine blueprint and the skydome blueprint arnt pawns. When we take the sedan basic vehicle template and build a progress bar and make an event tick do an incrmental integer we can do exactly as I need: use widgets that read the casts variables without touching the blueprint im casting to.

So it works for a pawn (the sedan in the simple car example) but not actors thaats what all our blueprints are. Can it be a character? A pawn? Whats the best way to build a submarine that will be able to be posessed (switch first person input off and switch to submarine input only, and sometimes both at the same time, but different keys)?

You should be able to do this with every actor. Otherwise you wouln’d be able to display Pings and Names from the PlayerState class as well as Ammo and Icons from a WeaponClass.

The Submarine should be a Pawn so that you can possess it, but that has nothing to do with the widget problem. The thing is, that you are casting nothing to your variable.
The left side of your cast node needs a reference. For example the other actor of an overlap event or the Hitactor of a line trace.

The reference to the sedan is made through “GetOwningPawn”. This works because at the time we are driving the Sedan, it is the HUD owners Pawn. There are other ways
like “GetPlayerCharacter” or “GetPlayerPawn” or “GetPlayerController->GetControlledPawn” etc. to get a NOT NULL reference that can be used:

But you are not using any real reference. You need to have a reference of an actor in your world and THAN cast it and save it to your variable.

Makes more sense now. We can “bandaid” it by getting all actors of class “avolantysubmarine” and then pulling out the first (and only) one found and getting the varible from that array index but that cuts the framerate in half since its checking all the levels actors over and over.

Will convert the submarine to a pawn, and hopefully we dont have to rewrite all the add force and buoyancy logic from changing from an actor to a pawn.

Thank you very much. Starting to make a little more sense, its a little fuzzy due to what im used to (the dirty word that starts with unity) but the whole actor vs character -> pawn thing is slowly coming together in my brain.