{ }Blueprint → C++

Unreal Engine 5 · Blueprint → C++

Play Widget Animation in Unreal Engine 5 C++UE Docs

The Play Animation Blueprint node maps to UUserWidget::PlayAnimation(MyAnim) in C++, where MyAnim is a UWidgetAnimation* exposed with the BindWidgetAnim meta specifier.

Blueprint node & C++ equivalent

C++
// MyAnim is a UPROPERTY(meta=(BindWidgetAnim)) UWidgetAnimation*
PlayAnimation(MyAnim);

What does the Play Animation node do?

Play Animation runs a UMG animation timeline you authored in the widget Blueprint's animation track, such as a fade-in or slide. In C++ you call PlayAnimation and pass a pointer to the animation.

The animation reference is bound automatically from the widget Blueprint when the C++ property name matches the animation's name.

The C++ equivalent

Declare the animation in the header as UPROPERTY(meta=(BindWidgetAnim), Transient) UWidgetAnimation* MyAnim;, then call PlayAnimation(MyAnim) from inside the widget. The BindWidgetAnim specifier links the property to an animation of the same name in the Blueprint.

PlayAnimation accepts extra arguments for start time, loop count, play mode, and playback speed, giving full control equivalent to the Blueprint node's pins.

Common mistakes

The C++ property name must exactly match the animation name in the widget Blueprint, or the BindWidgetAnim binding fails to compile or stays null. Mark the property Transient so it is not saved.

Calling PlayAnimation on a null pointer does nothing, so confirm the animation exists in the Blueprint and that the widget is properly constructed before playing it.

Frequently asked questions

How do you play a UMG animation in UE5 C++?+

Declare the animation with UPROPERTY(meta=(BindWidgetAnim)) UWidgetAnimation*, then call PlayAnimation(MyAnim). The property name must match the animation name in the widget Blueprint.

What is BindWidgetAnim in Unreal Engine 5?+

BindWidgetAnim is a UPROPERTY meta specifier that links a UWidgetAnimation pointer in C++ to an animation of the same name created in the widget Blueprint, so you can play it from code.

Can I loop a widget animation in C++?+

Yes. PlayAnimation accepts parameters for loop count and play mode, so you can pass a number of loops or zero to loop indefinitely along with start time and playback speed.

Related User Interface nodes

View all User Interface nodes →