Notes Specific to the Cocos Creator Version

Updated: 03/14/2023

This page is for Cubism version 4.2 or earlier. Click here for the latest version.

Notes on Loading the Cubism SDK for Cocos Creator into Cocos Creator

When using the sample models included in the Cubism SDK for Cocos Creator, you may not be able to use them as they are immediately after loading the Cubism SDK for Cocos Creator because the import order is not fixed.
If an error message is displayed, be sure to re-import model3.json or the folder that contains it by clicking [Reimport Asset].
In addition, there is a case in which [GlobalMaskTexture.asset] cannot be used correctly immediately after loading the Cubism SDK for Cocos Creator into Cocos Creator.
In this case, be sure to re-import [GlobalMaskTexture.asset] using [Reimport Asset] and restart Cocos Creator.

About Mask Drawing

GlobalMaskTexture.asset

Just after loading the Cubism SDK for Cocos Creator into Cocos Creator, masks may not be drawn correctly in [GlobalMaskTexture.asset].
In this case, be sure to re-import [GlobalMaskTexture.asset] using [Reimport Asset] and restart Cocos Creator.

In addition, the texture used in the mask may be drawn throughout the scene.
In this case, please name the User Layer 19 (e.g. MASK) in [Project] – [Project Settings] – [Layers] in Cocos Creator and uncheck the Visibility checkbox in the Main Camera of the scene.

Notes on TypeScript (JavaScript) Language Specification

Classes such as math.Vec2 and math.Vec3 provided by Cocos Creator, and the IStructLike interface implementation class provided by this SDK are instances in the language specification.

Note that changing the value of an instance member property so as to treat the structure like a language such as C# may cause unexpected behavior.

Note: The IStructLike interface implementation class provided by this SDK has its members set to “read only” so that the above change can be avoided in basic operations.

Note that the following cases are not errors due to language specification reasons as of Typescript 4.7.4.

export interface IReadonlySample {
  readonly x: number;
}
export interface ISample {
  x: number;
}
export class Sample {
  public readonly x: number = 0;
}

const a: ISample = new Sample(); // No error.
a.x = 1;

const b: IReadonlySample = new Sample();
b.x = 2; // TS: 2540 error
Was this article helpful?
YesNo
Please let us know what you think about this article.