Anima2D Skinned Mesh Renderer script ignores Order in Layer.

English is not my native language. sorry about this. please read carefully.

I’m using Anima2D.
I tried to reduce draw call. so I added Skinned Mesh Renderer Script on my character object.
There was no problem in Scene View. But in play view, Order in layer is messed up.
I think it ignores value of Order in layer, and draw images by Script Meshes Instances list order.

Is this normal? If is not, how can I fix it? Of course I could fix instance one by one. but I don’t want to.

I have the same problem here!

EDIT: you should use sortingLayerName instead of sortingLayerID (because the sorting layer ID is not the same as its index in the list (except “Default”, which is 0)). The code example from @lassade in the link below clearly demonstrates this. Rest stays the same.

Hi guys,

Had the same problem, here is (a hacky quick) solution:

First lets recap: SkinnedMeshRenderer is created

  1. at runtime
  2. by SkinnedMeshCombiner
  3. Sorting Layer and Sorting Order are properties of SkinnedMeshRenderer

So go ahead, open SkinnedMeshCombiner.cs script, and search for this code:

    combinedSkinnedRenderer = gameObject.AddComponent<SkinnedMeshRenderer>();
    combinedSkinnedRenderer.sharedMesh = new Mesh();
    combinedSkinnedRenderer.sharedMesh.CombineMeshes( combineInstances.ToArray(), true, true );
    combinedSkinnedRenderer.bones = bones.ToArray();
    combinedSkinnedRenderer.sharedMesh.boneWeights = boneWeights.ToArray();
    combinedSkinnedRenderer.sharedMesh.bindposes = bindposes.ToArray();
    combinedSkinnedRenderer.materials = spriteMeshInstances[0].sharedMaterials;

As you can see, the new combined mesh is NOT being assigned sortingLayer and sortingOrder. So if you add these two lines (hack):

    combinedSkinnedRenderer.sortingLayerID = m_combinedMeshSortingLayerId;
    combinedSkinnedRenderer.sortingOrder = m_combinedMeshSortingOrder;

You now have the values assigned, and all should work as expected, Just make sure that you defined those variables


somewhere in the class, and assign the layer id and order you would like.

Yet still, that’s a hacky way, isnt it? We would certainly instead like to have those values in the inspector (especially in case of the SortingLayers - a dropdown there with names of layers to choose from.

If u wanted that, you need a custom Editor override. This might help you immensely, it did help me:

Good luck!

I ask for the SkinnedMeshCombiner.cs script. That has been added. SortingLayerID and sortingOrder