BP to C++ how to access Objects in Animation Blueprints and Widgets from C++?

Hey everyone,

I’ve created some logic in Blueprint, but I can’t figure out how to implement that in C++.
I just want to set some public variables and/or call some functions. In BP this works flawlessly.
I grab an instance of either the Widget BP or the Animation BP and am able to access all public objects
from that instance.

This is the code I have so far for the managing the widget:


UPROPERTY(EditDefaultsOnly, BlueprintReadOnly)
TSubclassOf<UUserWidget> WidgetTemplate;

UUserWidget* WidgetInstance;


WidgetInstance = CreateWidget(GetWorld(), WidgetTemplate);

But apparently this widget instance is to generic, in order to call a specific function. Same happens
when I try to access animation blueprints in C++.

So how does it work? Is there some kind of object search function? Do I have to cast something?