Save/Restore the Values to Be Manipulated
Updated: 01/30/2020
Summary
This page describes the procedure for saving/restoring parameter values and part opacity for a Cubism model using ParameterStore.
The following explanation is based on the assumption that the project is the same as the project for which the “Import SDK” and “UpdateController Settings” are performed.
CubismParameterStore
If you import a model with “Live2D/Cubism/OriginalWorkflow/Should Import As Original Workflow” checked in the Unity Editor menu, the CubismParameterStore component will be set in the generated Prefab.
CubismParameterStore is a component that restores and saves Cubism model parameter values and part opacity before and after the AnimationClip is played.
This can be used to avoid the glitches that occur when other Cubism components manipulate values relative to each other, such as Additive and Multiply.
The value manipulations performed by Cubism components in Additive and Multiply blends assume that the value manipulations performed in the previous frame have been reset.
If the value is overwritten by AnimationClip, then the value manipulation by the Cubism component works correctly because the previous value manipulation is overwritten.
However, if the played animation does not manipulate the value, it may not behave as expected because the last manipulated value remains unchanged for the next update, resulting in duplicate values to be calculated.
CubismParameterStore saves all parameter values of the model to which it is attached at the LateUpdate() timing immediately after processing the animation, and restores the saved values at Update() of the next frame.
This allows components to operate normally on parameters whose values are not overridden by animation.
The following procedure is used to save/restore parameter values and part opacity for a model generated using the conventional method.
Note: To use ParameterStore, “UpdateController Settings” is required.
Attach CubismParameterStore
Attach “CubismParameterStore” to the GameObject that is the root of the model to save/restore values.