Can not bind float to UMG

I’m having a very frustrating issue with UMG.

I am trying to bind a distance value to my HUD, tracking how far away the character is to an object. I create the float variable in the crate that I’m checking and set the variable. To ensure this value exists properly I made a printscreen and it correctly displays the value. So it can’t be 0.

I then go to my HUD and bind the value exactly like I have for my health portion. Bind. Find the value. Return node. Simple.

However, whenever I play the text that should be returning my distance value instead displays 0 and the following error shows:

Accessed None ‘HidingCrateRef’ from node ReturnNode in graph GetDistancetoCharacter’ in blueprint GameHUD

I honestly have no idea what I could be doing wrong. I have bound other text and other values in UMG and haven’t had this issue. I provided screens showing my work.


You object ref is null, you have to initialize it with the targeted object

I’m not sure I understand, I’m sorry. How do I do that?

Your object is in your level?
Are you creating your widget from level blueprint?

Yes, the object is in the level. I’m creating the widget from my playercharacter blueprint.

One approach would be as follows: In the UMG Widget select the variable Hiding Crate Ref and toggle on the checkbox “Expose on Spawn”. Then locate where you create that UMG Widget, a new pin should be exposed called Hiding Crate Ref and plug in your reference to that variable.

Here is a solution,

Select your object and add it in your level bp, in beginplay event add “GetAllWidgetsOfClass” then “Get 0” ,then “Set HidingCrateRef” from the Get with the ref you added

I tried this and didn’t fix it :frowning:

You to have to set the ref in your widget (drag a wire from get and type Set HidingCrateRef)with ref of your object. , here is how to reference your object

Yup. I’m clueless. I can’t get this to work at all. I’m sorry for my difficulty.

I followed the directions in a completely different project in the link you set up. I can do everything except make it work with UMG. I can’t get it to properly reference to player character and the object calculating the distance to. I can get it to work in the level blueprint, but not in the UMG widget.

Do I need to use a blueprint interface?

Here is a complete solution

Widget + Text

Widget Graph (Tick)

Level Blueprint

Test :


I love you.

I was referring to the blueprint and not the actor :frowning: