How to access blueprint parent's class functions?

I have a UUserWidget child cpp class with two functions, Get and Set. (I’ll address it as myUUserWidgetChild)
I then made a ‘widget blueprint’ that inherits from myUUserWidgetChild.cpp, I made my ProgressBar in the blueprint widget that uses the GetFunction.

In cpp I have a UWidgetComponent class and I set the myUWidgetComponent->SetWidgetClass(myWidgetBlueprint).
I assumed, because myWidgetBlueprint inherits from myUUserWidgetChild, I should be able to access those two functions, but they do not appear under myUWidgetComponent->GetWidgetClass()->… or anywhere else I checked.

Is there a way I can access the “Set” function in this situation? What’s an alternative way of doing the same if I can’t? The actors that contain UWidgetComponent get spawned mid game so I can’t do much drag/droping in the graph editor, I thought this method would be pretty clean, the bar appears above the Actor as it should I just can’t find a way to update the percentage.

On your UserWidget blueprint … go to Graph View … Class Settings >> Class Options >> Parent Class … and make sure it is set to the appropriate UserWidget C++ class.

I don’t think that gets set automatically so you have to set parent for every custom UserWidget blueprint you make.

Yes I have, as mentioned I am already using the Get function in the graph also, within context.

Was a Solution for this ever found? I’m having the same issue

You need to cast the Object to your custom widget


UMyWidgetClass* WidgetClass = Cast<UMyWidgetClass>(SomeWidgetComponent->GetUserWidgetObject());