Performance Tuning of Cubism SDK for Unity

[Last updated: 01/31/2020]



Basically, performance tuning should be done using Unity's profiler to check for heavy processing areas.

In Cubism SDK, the structure of the model may affect its performance on the program.
In addition, because the Live2D SDK for Unity prioritizes clarity of structure, performance is intentionally sacrificed in some areas.
The following describes the impact of the SDK on performance.


Model Structure

For more information, please click here.


Project Structure

Unity Event Functions

As mentioned above, Live2D SDK for Unity prioritizes clarity of structure.
Therefore, the update process for each component is handled from Unity event functions such as LateUpdate().
This Unity event function is not less costly to call.
If multiple models are displayed using the SDK as is, performance may be very poor depending on the execution environment.
If performance is important, it is recommended that the update process for each component be called from a single Controller.
The CubismUpdateController included with the Cubism SDK for Unity performs similar processing to control the order of execution of Cubism SDK components, so the CubismUpdateController implementation can be used as a reference if the above response is desired.

For more information on CubismUpdateController, click here.


Handling Textures for Masks

Textures for masks used in Cubism models share a single global texture.
On Unity, the reference is set to the CubismMaskController at the time the Prefab is generated.

However, if the model's Prefab is made an AssetBundle as is, when the Prefab is instantiated, the texture for the mask set in the CubismMaskController changes from a reference to a copy being set.
Therefore, ignoring this specification will result in a memory drain as textures remain each time the model is repeatedly created and destroyed from the AssetBundle.

For more information on this phenomenon and how to prevent it, please click here.



© 2010 - 2022 Live2D Inc.