- Modifié
How to modify the sorting point of Spine in Unity2D?
I'm working on a 2D game. When I need to make the player and a tree have a correct occlusion relationship, there is a problem. I can't use Sprite Renderer
to modify Sprite Sort Point
to sort Click to modify to the foot of the Spine character animation, even if I place the root
in the animation at the foot of the character. Who can tell me how to modify or how to use Spine in Unity2D to follow the character and the occluder picture below put in order?
The picture below is my project settings
The picture below is the problem I encountered
At this point, the character Spine should be above this 2D SpriteRenderer
, but it doesn't, who can tell me how to do it? I have been troubled by this problem for two days :wounded:
Sorry for keeping you waiting for a reply. Our Unity expert, Harald is on vacation at the moment, so please wait a little longer until he returns for the solution to your issue.
Please note that since SkeletonAnimation
and SkeletonMecanim
(which I assume you are using) use a MeshRenderer
and not a SpriteRenderer
, there is no explicit Sprite sorting point that you can set. You might however want to use the same solution described in the forum threads below, using a SortingGroup
component, which then seems to use the pivot instead of the Mesh center for sorting:
unity中spine物体与其他物体的遮挡关系 (includes English translation)
Sprite Sort Point for Spine?
Harald a écritPlease note that since
SkeletonAnimation
andSkeletonMecanim
(which I assume you are using) use aMeshRenderer
and not aSpriteRenderer
, there is no explicit Sprite sorting point that you can set. You might however want to use the same solution described in the forum threads below, using aSortingGroup
component, which then seems to use the pivot instead of the Mesh center for sorting:
http://esotericsoftware.com/forum/unity-spine-18277 (includes English translation)
http://esotericsoftware.com/forum/Sprite-Sort-Point-for-Spine-10783
Thanks, I thought of another way, adding an empty GameObject as a sorting point under the spine, and dynamically modifying the sorting layer of "MeshRenderer" according to these sorting points
Thanks for sharing your idea, that's another valid approach.