Enabling Motion Fade in Mecanim
[Last 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 assumes that the “SDK is added to a project that has already been imported”.
To use fade functions such as motion fade and parameter fade set in motion3.json on Unity, use “MotionFade” in 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.
For more information on the fade function, click here.
If the models was imported with “Live2D/Cubism/OrignalWorkflow/Should Import As Original Workflow” checked in the Unity Editor menu,
MotionFade is set on the model.
To use MotionFade on a model that has not been configured above, follow the steps below.
- Attach CubismFadeController
- Set “model name.fadeMotionList”
- Attach CubismFadeStateObserver to each layer of AnimatorController
1. Attach CubismFadeController
Attach a “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 “model name.fadeMotionList”
Select the model and drag and drop “modelName.fadeMotionList” from the Inspector view to the “Cubism Fade Motion List” in the CubismFadeController.
* “modelName.fadeMotionList” is an asset that associates the InstanceId of the AnimationClip with the “.fade” asset and compiles it into a list.
* 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 AnimatiorController 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 CubismEditor will be applied when the animation fades.
The following is a playback of Animator Controller 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.
* Animation fades on layers to which CubismFadeStateObserver is not attached are faded by setting Transition.