Creating Runtime UMG Animation (UWidgetAnimation) in C++

Hi there!

I would like to create runtime UMG animation (UWidgetAnimation) in C++. No BP at all!

For the sake of clarity, I keep my sample project as simple as possible. I have a button, and I would like to make it move (change location) on my UserWidget. So far, I have created the UserWidget and the button. Everything is perfect.

When I want to add animation code, things start to get strange. For example; I cannot create a new UMovieScene object.

.h



UPROPERTY()
UMovieScene* pMovieScene;


.cpp



pMovieScene = NewObject<UMovieScene>(this);


Even though required headers are included, these lines give me “unresolved external symbol” error during compilation. What is the proper way of creating a new MovieScene object for UWidgetAnimation->MovieScene property?

And… Is there a tutorial or some kind of example snippet that entirely focuses on creating runtime UMG animation in C++? I searched the Internet thoroughly. So strange that there is almost no information available on this topic, except the following link:

https://forums.unrealengine.com/deve…e-ui-animation

Thanks in advance for any help you are able to provide.

Kind Regards,

Did you ever find out more about this?

I simply fixed the “unresolved external symbol” error by adding module name “MovieScene” to the PrivateDependencyModuleNames in Build.cs file.

However, any advice or a nice tutorial focused on creating runtime UMG animation in C++ would still be most welcome!

Thanks.

I have been working on figuring this out but my current workaround is just to use interp functions when a bool is true in tick. You could probably use curves and things like that as well. It would be pretty easy to do but not as organized as having it inside the animation.

Thanks for the tip, Burnrate.

As I had received no reply to my original post, that was precisely what I ended up with, months ago. I wrote a tick based time-driven code for managing curves that were manually linked to various UMG widgets’ properties. A bit messy and nothing by the book, but it saved the day.

Though not mandatory, I still would love to learn the formal way of creating runtime UMG animation using the Unreal Engine API.