UE4 UMG Timeline Animation Set Dynamic Key Value

Hi Everyone,

Do you know any way to control dynamically the Key Value of an animation in UMG Timeline?

I know how to do the opposite: Create a variable in blueprint > enable the “Expose to Cinematic” variable option > and then set any value into any animation for this variable.

But in my case, what I want is to be able to set different values to a Key into an animation depending the context.

For example, we have a 3 keys animation on the text color, with a nice eased curve (in and out cubic, or elastic, whatever you want):

In the context A : The text is white, then gradually turns RED (middle key), before turning white again.
In the context B : The text is white, then gradually turns BLUE (middle key), before turning white again.

So what I need, is to be able, for the middle key, to set the value to RED or to BLUE, depending the context (defined in blueprint through game events, or anything else).

What I want to avoid is:

  • have 2 specific animations turning the text to RED or to BLUE (and choose which one must be launched depending the context)
  • have 2 times the same text (one red one blue), both animated in the same animation, and turn visible only the good one depending the context.

In my example, I chose to manipulate a Linear Color Value, but the value to manipulate could be a float, integer, vector3 or anything else able to be animated through the UMG Timeline.

I very hope you guys can help me.
Thanks a lot

4 Likes

I have the exact same problem, but I don’t know if it’s possible at the moment, especially without C++. I found that UMG animations extend in some way the Sequencer code used for cinematics, and it’s really hard to add some widget inside an animation dynamically from the code or to change a keyframe value upon an existing tracked widget animation. What I’m trying to do now is to make the animation from C++ without the use of UMG Animations, but I really hope that in the next updates the engine will offer better ways to animate widgets other than simple fixed animations.

1 Like

Hi, Do you find the solution?

In case you, or any others looking at this post are still searching for an answer:

The answer is Yes, but only in development builds- not shipping builds.

It’s called “Sequencer Scripting” which is a beta plugin enabled by default.

With this you’re able to change the values of all the variable staples.

Gif1

Where the roadblock begins is needing to use the “Get Channels” function, which is for development only.

Now, I believe there MAY be a way to have it work in shipping builds, but only in theory. I don’t think anyone has tested it and even if it did work in a shipped build, I don’t think anyone knows how reliable it would be yet.

The method is to enable “Allow Explicit Impure Node Disabling” in Editor Preferences.

Gif3


For those of you who would still like to know how to do this

I have a small example of how, based off this resource and this video. In my case I was only using sequence scripting for a utility widget and everything worked great.

In the example, the idea was to hover over a button and keep it “lit up” by increasing the first key’s value in the UMG button animation.

Here is the Animation:

Gif2

Next was to access the keyframe through the sequence reference hierarchy. From top to bottom it goes:

“Get Bindings” > “Get Tracks” > “Get Sections” > “Get Channels” > (Match the name of the Channel) > “Get Keyframes” > then “Set Value”

Final Result:

Gif4

I hope this helps!!