Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Bug Additive Reference Pose to clip cannot be used in builds

Discussion in 'Animation' started by TimHeijden2, Jun 3, 2021.

  1. TimHeijden2


    Aug 11, 2016
    I have a scenario in which I'm using an animator with a lot of additive animations. In the editor, it is already possible to define a reference pose animation frame inside a specific animation:

    This creates an overhead though, because the animator would need to add a T-pose to all of the additive animations and then spend time configuring this animation in unity to not play in the actual animation itself. This becomes more problematic when using looping additive animations, where adding the reference T-pose breaks the curves and thus forces us to disable compression / resample curves.

    A proposed solution by @Mecanim-Dev is to use the AnimationUtility:

    Which would look something like this:
    Code (CSharp):
    2. foreach (AnimationClip clip in clipsToUpdate)
    3. {
    4.     // Option A
    5.     AnimationUtility.SetAdditiveReferencePose(clip, referenceClip, time);
    7.     // Option B
    8.     AnimationClipSettings settings = AnimationUtility.GetAnimationClipSettings(clip);
    9.     settings.hasAdditiveReferencePose = true;
    10.     settings.additiveReferencePoseTime = time;
    11.     settings.additiveReferencePoseClip = referenceClip;
    12.     AnimationUtility.SetAnimationClipSettings(clip, settings);
    13. }
    This solution has a few problems however:
    1. It only works using editor code, so you can't apply a reference pose at runtime
    2. This value is NOT serialized, meaning that it only applies for your local machine, and when you restart unity or reimport the file, you would need to apply it again. When making a build, you'd also need to reapply it.
    3. It doesn't actually work when you make a build in -batchmode

    I had already written code to constantly re-apply it to make it work in editor & normal builds, but it not working -batchmode either basically means that it is unusable and no longer a viable solution for us.

    This "bug" might borderline on a feature request, but it seems like a very important & basic thing to want to do. I can't imagine anyone that seriously uses additive animations wouldn't want to have a reference clip instead of needing to do a whole bunch of extra work.
  2. TimHeijden2


    Aug 11, 2016
    Last edited: Jul 8, 2021