HI, Where is Function "get user widget object" in UE4.17.2

hi.
I’m new with UE4 and I following a tutorial but I have a problem finding a function called “get user widget object”
I been trying but doesn’t appear. my version is 4.17.2 and I’ looked with a version 4.10 and is there so I tried to copy/paste it but no luck.
someone knows what can I do.
thank

When you work with widgets, you are either using a 2d interface or embedding them in components that can be placed in 3d world. GetUserWidgetObject is used when you want to gain access to the underlying 2d widget embedded in the WidgetComponent:

215560-capture.png

While blueprints are quite clever and offer context sensitive choices for the nodes, occasionally you may want to search for something in a more ham-fisted way:

215581-untitled.png

Ticking ContextSensitive off gives you access to all nodes.

2 Likes

Thanks for answer me great explanation. I tried and I have 2 results.
1 I tried following the tutorial which is at the construction script and doesn’t work even with you answer ( in the tutorial work great, he uses ue4.14 I think)
2 then, I when to event graph and it works.
But I don’t understand why at the construction scripts didn’t.
Do you know what can be?

It’s somewhat difficult to advise as I do not know what you are trying to achieve, neither do I know which tutorial you’re referring to :frowning:

Could you describe what the desired behaviour is in a couple of sentences and show a screenshot of the blueprint working / not working. That usually clarifies a lot!

1 Like

Mmm sorry, you’re right, I’m following a course by Christopher Murphy validated for epicgames or UE4. And my problem is setting up between a health bar widget and the blueprint character, going through the video tutorial in the construction script you get a reference to the healthBar widget and you call the function “get user widget object” (construction script)then cast to the healthBar widget blueprint to gain access a one function which allows as to change the percent of bar.
I hope now is more clear and thanks again for helping me.
I leave 4 screenshots to see more detail.
If you have access to de tutorial is in (section 3; adding healthBar)
I tried to do the same with a new project all empty and neither that work.

Super clear and informative.

Certain behaviours are no longer possible in the ConstructionScript, I believe it had something to do with circular dependencies. That tutorial must be a couple of years old now. I gave it a quick test and you’re right, this combination of nodes is conflicting with the BP constructor.

Here’s the solution, wrap it in a function:

And only then put in the ConstructionScript:

I tested it very briefly and it seems to be working as intended. If it does not for any reason, let me know, there’s probably a couple of other workarounds.

thank you very much I tested and it works great.

Great! Please consider marking this issue as resolved if it’s all working as intended now.

Brilliant! Thank you for the solution had the same problem and creating a separate function sorted it. Good to know.

I’m trying to implement the same functionality but am not able to do so, some guidance please?

It’s explained pretty thoroughly here, which part are you having problems with? Consider attaching a screenshot or a description of the problem.

I didn’t understand the ‘wrap it in a function bit’, because I’m trying to get the HealthBar widget to connect with Cast to UIHealthBar just like sernic77 pointed above. Where exactly do I define the logic before I put it in the construction script?

Thanks for your help!

Essentially, you can’t use GetUserWidgetObject in the Construction Script anymore. You can, however, use a function.

Create a new function, put the code there and call that function in the constructor instead.

Thanks guys this worked for me as well. Same tutorial!

I’m running into this issue in the current version of Unreal as well.

I’ve tried several methods and I can’t seem to get this thing to work.

Hi. I’m having the same problem with the same tutorial, but solution above isn’t working anymore. Inside the function casting to widget class always fails. More specifically, “Get user widget object” isn’t working and is returning null. The “Get object name” returns “Nothing” and IsValid check returns “Fail”.
But everything works if called from event graph. So as far as I understand you can’t use GetUserWidgetObject in the Construction Script at all, not even inside a function, it just doesn’t return anything.
[1]:

Hi I have doing the same course but i canąt wrap it into the function.
I tried to do that in two ways:

  • create custom event in event graph
  • create new function

I have the same problem in UE 4.22 (the same course) and i tried wrap it all in new function or in custom event in event graph. After this i tried to call this in construction script
I have the same result as @Luckbad had “Accessed none trying to read property Owning Knight…”
Someone solved this problem?

i tried doing it in a function i also tried doing it on a custom event and i get the same error, BTW i really did the one you suggested by putting the code in in a new function same error, i just tried doing the custom event later but still got the same error.

For those following this tutorial in late 2020, there is a different way to solve this. For some reason, GetUserWidgetObject is no longer valid in the construction script so it’s best to call the creation of the health bar in the same way we create the sword.

  1. Create a custom event in your KGCharacterBase EventGraph (where TryMelee, TryMagic, CreateSword are)
  2. Name it CreateHealthBar (or whatever you like)
  3. Use the exact same logic as in the tutorial (everything after setting HairColour in the Constriction Script)
  4. Call the CreateHealthBar event after you’ve called CreateSword (In Event BeginPlay)