Setting additive reference pose on non-imported animation?

I have a UI animation that is animated within Unity; it is on an additive layer, and the animation is it ‘appearing’ in the scene by moving off-camera into position.

The problem is that by default the first animation frame is used as the reference frame. This makes the UI element move away from it’s intended final position.

In imported assets you can set a custom frame as the animation reference pose, but I can’t find a way to do this in-editor for my animation.

There is the UnityEditor method, AnimationUtility.SetAdditiveReferencePose, but I don’t know what the least cumbersome way of implementing this is. I tried putting it in the Awake() method of the animation state’s StatemachineBehaviour, but this crashes Unity…so I expect I’m using it incorrectly.

Suppose you are moving the UIElement.position.x from -500 (off camera) to 0 (in position). According to default implementation, the additive offset is from 0 to +500, it is why it moves away.

AnimationUtility.SetAdditiveReferencePose Is not available at runtime. You can only use it in editor scripts.

My suggestions:

  • make a base animation (override) for this UIElement.position.x = -500 to compensate
  • or, select the additive animation, inspector change to debug mode, you will see:
    Additive Reference Pose Clip put the current clip
    Additive Reference Pose Time put the time (not frame) of reference pose
    Has Additive Reference tick it