Put Another Sprite between the Drawables of the Model

Updated: 01/30/2020

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

This section describes how to place another sprite between the Drawables of a model.

Summary

If you want to locate a part of the model to the foreground (or background), you can change the draw order from the Cubism Renderer, which is added to the model’s Drawable.
The draw order can be controlled by the value set to Local Order.

This allows some Drawables to be drawn in front of the sprite and other Drawables to be drawn behind the sprite when the sprite is placed between the set areas.

Procedure

First, change the Order In Layer value of the CubismRenderController component attached to the root of the model.

Then also change the value set in LocalOrder of the CubismRenderer component attached to each Drawable.
Order In Layer of CubismRenderController at the root of the model also affects the Local Order of all objects under /Drawables/.

For example, if Local Order is set to “1” when Order In Layer is set to “0,” the draw order of the Drawable will be set to 1.
If Local Order is set to “2” when Order In Layer is set to “3,” the draw order of the Drawable will be set to 5.
If Local Order is set to “-2” when Order In Layer is set to “5,” the draw order of the Drawable will be set to 3.
See the following link for more information on Order In Layer.
Unity Manual: Sprite Renderer

If you want to insert another sprite between Drawables as shown below, change the value of Local Order in the CubismRenderer component.
[Drawable] [Sprite] [Drawable]

Example: Let the Model Hold the Sprite

As an example, create a new sprite and pose the model as if it were holding the sprite at its side.

First, set up the Sprite. Right-click in the Hierarchy window and click “2D Object” > “Sprite” to create a new Sprite.
Then click on the Sprite you created and set the Sprite Renderer > Sprite item in the Inspector window to UI Sprite. Also, set “1” for Sprite Renderer > Order In Layer.

Next, set up the model.
Set the Local Order value for the left hand and left forearm of the model to “2.”
This way, the left hand and left forearm are drawn in the following order: left hand and left forearm with changed values, Sprite, and model with no values set.

With the above settings, the left wrist and left forearm will be drawn in the following order: left wrist and left forearm with the values changed, Sprite, and then the model with no values set.

Was this article helpful?
YesNo
Please let us know what you think about this article.