Hello.
The SDK version I am using is CubismSdkForUnity-4-beta.2
I am using a script to update my model's parameters at runtime.
It appears to animate the model just fine when I play the project in the Unity editor. But then when I select the "Maximize On Play" button and play the project in the Unity editor, the model does not animate. It also will not animate when I build the project into an executable. It only animates in the Unity editor, and only when the Unity editor is not in "Maximize On Play" mode.


In order to display my model over everything else, I have it attached as a child to a blank (transparent) image that belongs to a canvas, which references the scene's main camera.

My script for manipulating the parameters has an implementation that looks like this (which is in the LateUpdate() function:


I wrote this with help from the instructions here:
https://docs.live2d.com/cubism-sdk-tutorials/about-parameterupdating-of-model/#This works, but only in the Unity Editor. If I build the project, or if I maximize the game preview in the Unity Editor, the script does not have any effect on the model's parameters.
If I print the parameter.Value to the Debug.Log(), I can see that it is still manipulating the parameter:

However, the model on the screen does not reflect these parameter changes, unless I run the game in the Unity Editor without setting the game preview to "Maximize On Play."
Because my script works to update the parameters in the Unity Editor, I wonder if I am missing something that makes it stop working when I "Maximize On Play" or build the project.
I created my model in Live2D Cubism Editor 4.0, and I imported it into my Unity project by following the instructions here:
https://docs.live2d.com/cubism-sdk-tutorials/getting-started/#
Comments
It seems I am still using LWRP instead of Unity's new SRP. I fixed my problem by changing CubismModel.OnRenderObject() to CubismModel.LateUpdate() and setting the CubismModel script execution order to last.