[Last updated 01/30/2020]



Motion allows you to play back animations from scripts without having to set up a state machine in Unity's Mecanim.

Motion requires the CubismFadeController component and Unity's Animator.
When an AnimatorController is set as the Animator component, the AnimatorController's animation will be played instead of Motion.

The corresponding tutorial article can be found here.

Motion performs the following processes.

  1. Create PlayableGraph
  2. Create CubismMotionLayer
  3. Animation Playback
  4. Animation stop


Create PlayableGraph

PlayableGraph is used to output animations, etc.
For more information, please refer to the official Unity documentation.

This is handled by CubismMotionController.OnEnable().


Create CubismMotionLayer

CubismMotionLayer allows multiple motions to be played back in parallel.

This is handled by CubismMotionController.OnEnable().



When motion is played on multiple layers simultaneously, if they operate on the same CubismParameter.Value, it will be overwritten by the value set later.
The weight to be overwritten can be set with CubismMotionLayer.SetLayerWeight(float weight).
If you set weights on the CubismMotionLayer, you must also set weights on the AnimationLayerMixerPlayable at the same time.

For more information on AnimationLayerMixerPlayable, please refer to the official Unity documentation.



Animation Playback

Animation can be played by using CubismMotionController.PlayAnimation (AnimationClip clip, int layerIndex = 0, bool isLoop = true, float speed = 1.0f).

  • AnimationClip clip: Animation clip to be played.
  • int layerIndex: Index of the animation playback layer.
  • int priority: Priority of animation to be played. If the animation is to be played by plugging it into the currently playing animation, the value should be greater than the PRIORITY set for that animation.
  • bool isLoop: Whether the animation is looping or not, the default is looping.
  • float speed: Animation playback speed, range is greater than or equal to 0, default is 1 (normal playback speed).


Animation stop

Use CubismMotionController.StopAnimation (int animationIndex, int layerIndex = 0) to stop the animation of the specified index.

  • int animationIndex: Index of the animation to be stopped.
  • int layerIndex: Layer index of the animation to be stopped.

Use CubismMotionController.StopAllAnimation () to stop all animations.

© 2010 - 2022 Live2D Inc.