[INFORMATION](4/25/2024)
Cubism Editor 5.1 alpha3 is now available!
We have incorporated some of your comments and suggestions. Thank you for your comments and requests!
We will continue to welcome your feedback on alpha3.
Download/
Manual and Update History
How do I reference the model from a script?
Is there any way I can reference a Live2D model within a script instead of modifying it inside LAppModel.cs, for example?
I tried public Live2DModelUnity live2dmodel; but it always returns as null.
0 ·
Comments
using live2d;
using live2d.framework;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PrintHandPosition : MonoBehaviour
{
L2DBaseModel lappmodel = new L2DBaseModel();
// Update is called once per frame
private void Update()
{
var l2dmodel = lappmodel.getLive2DModel();
Debug.Log(l2dmodel);
}
}
I want to control my model motion parameter from a script, if you can help me write the snippet of the code for that (without modifying any files from Sample1App) it would be much appreciated!
However I still can't get setParamFloat to work, could you see what did I do wrong here?:
using live2d; using live2d.framework; using System.Collections; using System.Collections.Generic; using UnityEngine; public class PrintHandPosition : MonoBehaviour { private L2DBaseModel l2dbasemodel; private LAppModelProxy _proxy; private ALive2DModel themodel; // Use this for initialization void Start() { if (_proxy == null) { _proxy = GameObject.Find("Live2D_Canvas").GetComponent<LAppModelProxy>(); } var model = _proxy.GetModel(); themodel = model.getLive2DModel(); } // Update is called once per frame private void Update() { themodel.setParamFloat("PARAM_CHEEK", 1, 1); //this line simply has no effect themodel.update(); Debug.Log(themodel); } }