Howdy, Stranger!

It looks like you're new here. Sign in or register to get started.

If you have any questions, reports, suggestions, or requests about Live2D, please send them to this forum.
※We cannot guarantee statements or answers from Live2D staff. Thank you for your understanding in advance.
 
Live2D Cubism
Cubism Products and Downloads
Cubism product manuals and tutorials
Cubism Editor Manual    Cubism Editor Tutorial    Cubism SDK Manual    Cubism SDK Tutorial
[INFORMATION](03/28/2024)
Cubism Editor 5.1 alpha version is now available!
Find out how to use the new features here.
Please take this opportunity to use it and give us your feedback!

For more information and download, please check out the Cubism Editor 5.1 alpha category.

Instantiate prefab loos motion smothness.

edited December 2023 in Help
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

Best Answer

  • edited March 2023 Answer ✓
    Hello, @longbearded .

    Thank you for your continued use of our product.

    Part of the functionality of the Cubism SDK for Unity depends on the order in which scripts are executed.
    However, since Unity determines the execution order of scripts, the execution order of scripts is controlled on the SDK side.
    Therefore, scripts whose execution order is not controlled by the SDK may have unintended behavior depending on the execution order.

    Could you please confirm if the problem can be resolved by modifying the script in question to control the order of execution in the SDK?
    https://docs.live2d.com/en/cubism-sdk-tutorials/updatecontroller/

    Best regards.

Answers

Sign In or Register to comment.