Download

UMG: Finding an animation by name in C++

In C++ land, I’m trying to call UUserWidget::PlayAnimation(). It expects to be passed in a UWidgetAnimation pointer. I have the name of the animation I want to play, but I don’t know how to get from there to an animation pointer. I tried to use the following, but it didn’t work:


UWidgetAnimation *AnimPtr= FindObject<UWidgetAnimation>(userWidget->GetOuter(), TEXT("AnimationOne"), true);

I admit, I’m not exactly familiar with how assets are stored and retrieved in Unreal Engine 4…