How and when are variable values cached/read for animation transitions?

Hi there,

(UE 4.12.5)

We had a case where a the animation system in an animation graph does something we don’t expect while setting variables during transition events.

I’ve made a simple reproduction case that highlights my problem.

Setup

The premise is simple, we have a start node, that waits for a variable “Start Process” before transitioning to the DECIDE node. A second variable “Go To Node B” will determine whether DECIDE will end up in NODEA or NODEB.


Transition rule for DECIDE → NODEA


106654-4.png


Transition rule for DECIDE → NODEB


106655-5.png

At this point as “Go to Node B” is true by default, if I run the graph and trigger “Start Process”, I’d expect the final state node to be “NODEB”. This works as expected.

I now add custom events to set “Go to Node B” to false.


First place is on the “Entered State” node:

106658-2.png

Second event is on the “start transition” event of the “Start->Decide” transition.

106659-3.png

The “ResetGoto” event in question simply sets “Go to Node B” to false, which should cause the final node to be A instead.

What I Expect:

The thinking is that we switch over to DECIDE, and during this switch we then have some logic that decides whether “Go to Node B” is true or false. After switching to DECIDE the appropriate transition should be made based on the current value of the variables.

What actually happens

Now if I ran the graph and triggered the “Start Process” variable, I still end up in node B at the end despite the fact that the value test for going to node B is false. I tried outputting the values of the variable along the way, and it all clearly states it’s FALSE. Yet the transition to node B still is taken.


What it looks like to me, is that at the start of the frame the “YES/NO” value for all transitions are evaluated, and then the state machine is traversed without taking into account any possible changes.
Is this assumption correct? Or am I missing something else…

I had more pictures, but it seems I hit the attachment limit - if anything is unclear please let me know and I’ll try to explain it better :slight_smile:

Kind regards,

Johan Conradie

Black Forest Games GmbH

This is still problem in 4.18.3 it forces to use tedious workarounds. Is there reason for this behavior?