Hi, this is probably something simple, but I’m a noob when it comes to animation and can’t figure this out.
In my Anim BP I have an animation graph with generic Locomotion state machine and a Phone state machine. The latter one is for blending in animations like answering a call or looking at a phone. The phone state machine is layered with the base locomotion using a blend mask for the upper body only.
In my phone graph I have the basic Locomotion state (just plays the cached locomotion graph) and a “Look At” state which plays an animation of taking a phone out of the pocket and looking at it. Transition is on a boolean variable change and runs on defaults, except the duration is set to 2s for smoother blend.
This works fine in the editor, no matter what I do, PIE or just preview in the anim blueprint preview. The problem is in packaged build there seems to be no blend. The “Look At” state animation just snaps in instantly with a visible pop.
My gut feeling tells me it has something to do with streaming, since editor caches assets, so there’s no issue there, but the animation in package is not cut off or anything, it just snaps in place without a blend.
Either way I tried to make a dummy Animation Sequence Object variable to hold a hard reference to the phone animation, hoping it would keep it loaded, but it doesn’t help. I don’t know if making a hard ref to the anim sequence also loads the anim data itself or is that steamed independently?
Here’s what the Phone graph transition looks like and a video of it in editor and in packaged build.
Any idea how to fix it or what to check would be appreciated.
Right, so the editor/packaged thing was a red herring, because it turns out I set the initial state of the anim graph for that scene a bit differently when starting the play from editor, so I was able to reproduce the issue without packaging the game. My bad 
Nevertheless there’s something happening I don’t fully understand. I mentioned I use a layered blend for the Phone state machine. I use the 0-1 weight on that node as an off-on switch. A separate boolean variable then controls the transition within the state machine.
So what happens is when I enable layered blending by setting the weight to 1 and then, after some time I set the boolean to true I get the blend, the exit, enter and fully blended events on the Locomotion and Look At states as expected. But when I enable layered blending with the bool already set to true I do get the exit and enter events on the States, but there’s no blend or fully blended event.
Is skipping of the blend expected when entering a state machine with conditions already moving it to a further state? That doesn’t seem right to me. I can’t seem to find anything to control this behavior. There are some experimental features for dead blending that get enabled by default on the transition pin, but turning those off doesn’t seem to change anything.
Hi @chrisaverage
Typically when a transition duration is honored in PIE but not in a packaged build, the culprit is usually one of several common issues related to frame rate, asset loading/streaming or state machine crossfade settings
Transition Crossfade Sharing Settings
Looking at your transition properties screenshot, it seems that under Transition Crossfade Sharing you have it set to “Use Shared”
Sometimes shared crossfades can be skipped or fail to instantiate correctly in a packaged build if the state logic or transitions fire right after each other or if assets weren’t pre loaded correctly yet
Could you try setting it to None just to see if you can get the standard crossfading to work?
Delta Time/Frame Rate Problems in Packaged Builds
If you’ve got a packaged build running at significantly higher or unlocked frame rates than PIE or if Delta Time isn’t being updated properly while transitioning through the tick, the 2.0s duration can effectively be squashed into a single frame.
You might want to test limiting your target frame rate or see if the transition rule evaluation is attached to a variable that switches its state immediately on the tick with no time interpolation involved
Asset Streaming & Preloading
Your hypothesis about asset streaming is entirely reasonable. You see if the target Animation clip isn’t yet fully loaded in memmory for the transition rule to evaluate to true, UE could potentially snap to the end pose or snap upon the asset loading in.
You can test this theory by attempting to pre load a reference to the Animation asset beforehand or by experimenting with a Layered blend per bone node with an explicit Alpha curve instead of relying on state transition Crossfades
Could you let me know if changing Transition Crossfade Sharing to None has any effect or do you use some form of custom plugin/streaming setup for your char assets?
For additional reference on how to properly set up layered blends and transitions for state machines in Unreal Engine: State Machines Transition Rules
I’m sorry I didn’t read this second reply. What you are describing with the Layered Blend weight and the state machine initial evaluation sounds like normal behavior for Unreal’s AnimBPs evaluation order.
When the blend weight for the Layered Blend is 0 that whole branch is asleep. As soon as you set the weight to 1, the inner State Machine wakes up to evaluate its states and transition rules for that frame (If your boolean is true at that moment the State Machine will evaluate the transition immediately on wake up, skipping the crossfade blend because “Look At” is its starting state for that evaluation)
Use Inertial Blending (or Dead Blending)
Instead of using a standard State Machine transition crossfade when waking up the state, try to use an Inertialization node right after your Pose/State Machine or set the blend type on your Layered Blend/Transition to Inertialization.
When the state change is triggered, call a Request Inertialization node. This will smooth out the pose to pose transition even in the case of an instant frame based state change
Blend using the Layered Blend Weight instead of the State Transition
If you want to have a smooth 2 second blend into the “Look At” state you can leave the State Machine transition instantaneous (or whatever is your desired state) and drive the Alpha/Weight parameter of the Layered Blend per Bone node over time (with a Timeline, Interp To, or Blend Simple/Alphas curves) from 0.0 to 1.0.
This means that the animation is already in the “Look At” pose internally and you are smoothly blending your upper body layer into the locomotion.
Delay the boolean setting by 1 Frame
If you want to maintain the state machine transition blend, make sure the layered blend weight reaches 1.0 before setting the boolean to true (to properly initialize in the Locomotion state) and set the boolean to true on the next frame or with a small delay
I hope this makes sense to you
Thanks for the response.
Honestly it doesn’t make sense to me. It triggers the events along the way but not the blend. Either jumping straight to the result or doing the whole trip would make sense, but this kinda does half the job. Eh, it’s weird to me but it is what it is. At least I know how it works now.
I’ll try inertialization at some point (never used it before, I’m a noob like I said), but it’s a long slow transition to somewhat different poses. It doesn’t seem like the best here, but I’ll see.
Using the weight on Layered Blend works, but I don’t like the idea that I have to drive the weight value externally. Kinda defeats the point of an animation graph a little bit if you have to animate values manually outside of it. There’s a “blend poses by bool” node with a blend time, which would work great, except it doesn’t do per bone masking. I could use Layered blend per bone followed by blend by bool, but that seems like a lot of overhead for such a simple transition. A “Layered blend per bone by bool” node would be perfect 
Anyway, thanks again for your inputs. At least I know what I’m dealing with, so I can work around it.
Hi @chrisaverage
I understand what you mean, that it seems counter-intuitive to have the state transition events happen but skip out on the visual blend by going through AnimBP evaluation logic for state machine to layer weight interactions
Here are two self-contained approaches to accomplish this in a clean manner within the Anim Graph
Use an Anim Curve in the sequence/state
If the animation sequence for “Look At” has one (or if you manually add a curve to the Anim Sequence editor ranging from 0 to 1) you can use its value in the Anim Graph directly using a Get Curve Value node to drive the Alpha pin of your Layered Blend per Bone node.
Basically, simply playing the state/animation would affect the blending weight natively within the AnimBP without having to use any Blueprint code
Combine Blend Poses by Bool with Layered Blend Per Bone
Your idea of combining them is not as high of an overhead as it seems. Your pose blending is extremely optimized on unreal’s engine.
Passing a pose through a blend poses by bool node either right after or right before the layer blend add virtually no overhead in terms of performance cost in execution as well as keeping all your transition duration logic neatly tucked away on the node pin
Inertialization with custom blend time
If you ever use Inertialization, you can specify a custom blend time on the transition or the node itself.
Even long transitions (1-2 sec) work surprisingly well for big pose changes as long as both poses are valid
Glad to help to clear up confusions on what’s happening!
Best of luck with your project! And do feel free to ask for help with other animation setup problems