Enable Motion Fade in Mecanim

Updated: 01/30/2020

This page explains how to use MotionFade for Cubism models and how to apply Cubism fades to animations played back in Unity’s Mecanim.
The following explanation is based on the assumption that the project is the same as the project for which the “Import SDK” was performed.

Summary

To use fade functions such as motion fade and parameter fade set in motion3.json in Unity, use “MotionFade” in the Cubism SDK for Unity.
Cubism’s fade function allows the blend ratio when switching between motions to be curved and smoothly switched, or the switching time to be changed for specific parameters only.
See “Setting Fade Values” for more information on the fade function.

If the model was imported with “Live2D/Cubism/OriginalWorkflow/Should Import As Original Workflow” checked in the Unity Editor menu, MotionFade is set for the model.

To use MotionFade for a model that has not been configured above, follow the steps below.

  1. Attach CubismFadeController
  2. Set “modelName.fadeMotionList”
  3. Attach CubismFadeStateObserver to each layer of AnimatorController

1. Attach CubismFadeController

Attach “CubismFadeController” that controls the fade to the GameObject that is the root of the model.

– Cubism Fade Motion List: Set “modelName.fadeMotionList.” Details are explained in Step 2.

2. Set “modelName.fadeMotionList”

Select the model and drag and drop “modelName.fadeMotionList” from the Inspector View to the “Cubism Fade Motion List” in the CubismFadeController.

Note: “modelName.fadeMotionList” is an asset that associates the InstanceId of the AnimationClip with the “.fade” asset and compiles it into a list.
Note: The “.fade” asset is an asset that stores motion data and is automatically generated from motion3.json.

3. Attach CubismFadeStateObserver to Each Layer of AnimatorController

Select AnimatorController and attach “CubismFadeStateObserver” to the Inspector View of each layer in the Animator window.

This completes the setup for controlling fades using MotionFade.

When the Scene is executed in this state, the fade value set in Cubism Editor will be applied when the animation fades.

The following is a playback of AnimatorController with Transition set to 0, with and without MotionFade set.
The left side is finished in 0 seconds set for Transition because MotionFade is not set.
On the right, MotionFade is set so that the Transition by Animator is overridden by the MotionFade and ParameterFade of Cubism.

Note: Animation fades on layers to which CubismFadeStateObserver is not attached are faded by setting Transition.

Please let us know what you think about this article.