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 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.
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.
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:
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”