Updated: 06/10/2021


Live2D Cubism handles some of the data for runtime in json format.
Cubism SDK for Unity includes classes to parse and instantiate those json format files.

They are parsed and instantiated when imported by the asset importer included with the SDK, but can also be loaded at run-time by the user.


Parser for .model3.json.

You can get the path to various other json files, such as motion and facial expressions described in .model3.json.

To parse .model3.json in CubismModel3Json, use CubismModel3Json.LoadAtPath().

var json = ((TextAsset) Resources.Load<TextAsset>("path/to/file")).text;

var model3Json = CubismModel3Json.LoadAtPath(json);

From the parsed data, it is possible to obtain the relative paths to the various files described in .model3.json.

// .moc3
var mocPath = model3Json.FileReferences.Moc;

// textures
for(var i = 0; i < model3Json.FileReferences.Textures.Length; i++)
    var texturePath = model3Json.FileReferences.Textures[i];

// .physics3.json
var physicsPath = model3Json.FileReferences.Physics;

// .userdata3.json
var userdataPath = model3Json.FileReferences.UserData;


Typically, the path can be obtained with the same structure as the hierarchy of .model3.json, but the reference to the data for expression described in .model3.json has its own structure.
This is because the .model3.json structure in Cubism cannot be parsed by JsonUtility, Unity’s built-in JSON parser, due to its specification.
In Cubism SDK for Unity, only expression data references are parsed by our own JSON parser.

To generate a model Prefab from the parsed .model3.json, use CubismModel3Json.ToModel().

// Initialize
var model = model3Json.ToModel();

// Original Workflow
var modelForOW = model3Json.ToModel(true);

The processing implemented in Cubism SDK for Unity assumes that assets in the project are loaded from the Unity editor.
When loading at runtime from an AssetBundle or other source, the loading process must be implemented by the user.

View our tutorial here for more information on how to load a model at runtime.


Parser for .motion3.json.

AnimationClip can be generated from the curve information described in .motion3.json.

To parse .motion3.json in CubismMotion3Json, use CubismMotion3Json.LoadFrom().

var json = ((TextAsset) Resources.Load<TextAsset>("path/to/file")).text;
var motion3Json = CubismMotion3Json.LoadFrom(json);

To generate an AnimationClip from the parsed .motion3.json, use CubismMotion3Json.ToAnimationClip().

// Initialize
var animationClip = motion3Json.ToAnimationClip();

// Original Workflow
var animationClipForOW = motion3Json.ToAnimationClip(true, true, true, pose3Json);


Parser for .userdata3.json.

User data can be applied to the model’s ArtMesh from the information described in .userdata3.json.

To parse .userdata3.json in CubismUserData3Json, use CubismUserData3Json.LoadFrom().

var json = ((TextAsset) Resources.Load<TextAsset>("path/to/file")).text;
var userData3Json = CubismUserData3Json.LoadFrom(json);

To retrieve user data from the parsed .userdata3.json, use CubismUserData3Json.ToBodyArray().

var drawableBodies = userData3Json.ToBodyArray(CubismUserDataTargetType.ArtMesh);


Parser for .physics3.json.

Physics settings described in .physics3.json can be converted for use in Unity.

To parse .physics3.json in CubismPhysics3Json, use CubismPhysics3Json.LoadFrom().

var json = ((TextAsset) Resources.Load<TextAsset>("path/to/file")).text;
var physics3Json = CubismPhysics3Json.LoadFrom(json);

To convert physics settings from the parsed .physics3.json to a format handled by Unity, use CubismPhysics3Json.ToRig().

var cubismPhysicsController = GetComponent<CubismPhysicsController>();


Parser for .exp3.json.

The information about facial expression differences described in .exp3.json can be converted into a format that can be handled in Unity.

To parse .exp3.json in CubismExp3Json, use CubismExp3Json.LoadFrom().

var json = ((TextAsset) Resources.Load<TextAsset>("path/to/file")).text;
var exp3Json = CubismExp3Json.LoadFrom(json);


Parser for .pose3.json.

From the information described in .pose3.json, you can obtain the settings that control the display state of the part in Unity.
In Cubism SDK for Unity, Pose is used to process the curves of the generated AnimationClip.

Click here for more information on the Pose function.

To parse .pose3.json in CubismPose3Json, use CubismPose3Json.LoadFrom().

var json = ((TextAsset) Resources.Load<TextAsset>("path/to/file")).text;

var pose3Json = CubismPose3Json.LoadFrom(json);


Parser for .cdi3.json.

The .cdi3.json file contains the names of the parameters, parts, and parameter groups set in the Cubism editor, and each ID that pairs with them.

In Cubism SDK for Unity, it is used to display the names of parameters and parts in the Inspector window.
If the model does not have a .cdi3.json, the ID will be displayed.

To parse .cdi3.json in CubismDisplayInfo3Json, use CubismDisplayInfo3Json.LoadFrom().

var json = ((TextAsset) Resources.Load<TextAsset>("path/to/file")).text;

var cdi3Json = CubismDisplayInfo3Json.LoadFrom(json);
Was this article helpful?
Please let us know what you think about this article.