Instantiate prefab loos motion smothness.
Hi,
I create small test script and assigned it to a prefab imported with Live2D model.
using Live2D.Cubism.Core;
using UnityEngine;
public class TmpBaseMovement : MonoBehaviour {
public string ParameterID;
private CubismModel _cubismModel;
private CubismParameter _cubismParam;
private float n = 0;
private void Start() {
_cubismModel = gameObject.FindCubismModel();
_cubismParam = _cubismModel.Parameters.FindById(ParameterID);
}
private void LateUpdate() {
n += 3 * Time.deltaTime;
_cubismParam.Value = Mathf.Sin(n) * 30;
}
}
When I added prefab to hierarchy move is fluent and smooth. When I instantiate the same prefab by `Instantiate(ModelPrefab)` then move is hard and straight, like be all physics not work at all.
Why that happens and where I should looking for fix?
Live2D Cubism version - [4-r.5] - 2022-09-08
Unity 2021.2.13f1
0 ·
Answers
Anyway I want to understand why it was happened. Can you recommend me some article/tutorial which can help me understand problem of script execution, and why instantiate prefab give mu effect described above.
Update:
I already find a solution https://docs.live2d.com/en/cubism-sdk-tutorials/using-update-controller/ - Implementation of `ICubismUpdatable` interface help a lot.