Timing of Value Operations in Cubism SDK for Cocos Creator

Updated: 03/14/2023

This page is for Cubism version 4.2 or earlier. Click here for the latest version.

When manipulating the values of model parameters in Cocos Creator, it is recommended to do so at the time of Component.lateUpdate().

// Not recommended
update(deltaTime: number)
{
  model.parameters[0].value = value;

  CubismParameterExtensionMethods.blendToValue(model.parameters[1].value, CubismParameterBlendMode.Additive, value);
}

// Recommended.
lateUpdate(deltaTime: number)
{
  model.parameters[0].value = value;

  CubismParameterExtensionMethods.blendToValue(model.parameters[1].value, CubismParameterBlendMode.Additive, value);
}

In the Live2D Cubism SDK for Cocos Creator, animation playback uses Cocos Creator’s built-in Animation, which applies parameter values between Component.update() and Component.lateUpdate().
Therefore, if a parameter value is set in Component.update(), the value may be overwritten by the animation due to the execution order.

See the official Cocos Creator documentation for more information on Cocos Creator’s event functions.

Was this article helpful?
YesNo
Please let us know what you think about this article.