Cautions When Using SRP

Updated: 01/31/2022

Summary

Unity added the “Scriptable Render Pipeline (SRP)” in 2018.1, a mechanism that allows C# scripts to control rendering settings and execution.

See the official Unity documentation for more information on SRP.

When using this render pipeline, some Unity event functions are not called.
This may cause the Cubism SDK for Unity to not work properly.

We are currently working on a response to this event in the Cubism SDK.

[Added on 01/31/2020]
SRP is now supported in the Cubism 4 SDK for Unity R1 or later.
If you are using the Cubism 4 SDK for Unity beta2 or earlier, please follow the modification procedure below.

Below are the details and how to correct any issues.

Causes

In the Cubism SDK for Unity, each Cubism component is updated with LateUpdate(), and the value set here is used to update the mesh with CubismModel.OnRenderObject().

OnRenderObject() is a function that is called in Unity’s traditional render pipeline when a Camera component placed in a Scene has finished rendering.
However, when using Unity’s SRP, the event functions issued by the Camera are not called.
Therefore, if you use the Cubism SDK for Unity without modification, updated parameters and other values are not reflected in the mesh, so the model on the screen cannot be animated.

Countermeasures

The issue can be dealt with by processing CubismModel.OnRenderObject() at a different time.

The issue can also be dealt with by calling it from LateUpdate().
However, if the processing of each component of Cubism is called after CubismModel, the values manipulated in that component will not be reflected, so it is necessary to explicitly set the order in which CubismModel is executed to be last.
Please control the execution order of CubismModel by setting the execution order in Unity functions, using CubismUpdateController, or other methods.

The issue can also be dealt with by using Unity’s PlayerLoop class.
PlayerLoop can manipulate event function calls by Unity, preventing existing event functions from being called, or inserting user-defined function calls at desired times in the lifecycle.

See the official Unity documentation for more information on the PlayerLoop class.

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