Widget component cast not working

I’m kind of new to Blueprint with UMG, so maybe my thought process is completely wrong here, but this is what I am doing:

  1. Created a widget component named “DebugWidget”

  2. Set the widget component class type to “DebugWidget”, which is just a simple widget with an image exposed as a variable.

  3. Cast the widget component to my DebugWidget so I can retreive the image and change the color of it.

Step 3 is failing and I have absolutely no clue to why this would happen, unless if somehow the widget component holds a reference inside to the DebugWidget, without actually being it…

So how do I do something like this correctly?

1 Like

I have the same issue. I just need to get a variable and the cast fails every time (when the editor doesn’t crash, as it does every two minutes, for random reason like popping up the context menu in graph…)

I think the 3d widget is just broken currently and we will have to wait for an update.
If i have something new i’ll let you know.

Bump! Anyone?

Hi there,

I was having the exact same problem, and I found your question while trying to find a solution.

I managed to get it working (YAY!). Basically, I was trying to cast the Widget Component in my blueprint the original Widget Blueprint.

When I was trying to get it working I just typed in “widget” into the context menu and found “Get User Widget Object”.

I then plugged this into the cast as you had previously done and it worked. :slight_smile:

On your one, just replace “Debug Widget” Widget Component with “Get User Widget Object”. Hopefully it should work.

Here is a picture below, and it works! Let me know how you get on.

All the best! :slight_smile:

6 Likes

You’re a hero!

I know this is late, but thank you.

Thaaaaanks!

Hey Roel, could you mark this off as the Answer :slight_smile: thanks

Thanks man, i was really bugged by this!

Doesn´t have this “Get User Widget Object” option in my case. I´m trying to cast a widget from another widget, anyone maths with the option you mentioned.

+1 on the answer

Yay! Thanks dude :smiley:

Thank you so much!

Same, I can’t find it too!

This may help. Shows how to get widget references from other widgets. The trick is to find out where the widget was “created” and store it as a variable you can access from other BPs. I also explain the “get user widget object” node, as it isn’t clear from the above screen shot.

And If This Doesnt Work, Create A Widget (Add Component: Widget) IN The Enemy BP For Example, Then Assign That Widget That Widget BP Your Trying To Access, Then Use That Then Draw A Get User Widget Object Then Attach To Cast To That Widget BP, Then It Will Work, BRU!
Was Trying To Call An Int From A Widget Bp, To Check Which Death Anim The Enemy Should Play Upon Being Shot With The Right Character/Gun, Works, BRU!

solved my issue! thank you so much!

I don’t understand why it works but, this led me to trying to first cast to UserWidget BEFORE casting to my final widget class… and THAT worked.