UkiTakuMuki

Hi!

Kudos on your software, I've enjoyed working with it over the past year on a top-down game.

Problem: I cannot access the [Draw Order] of [sprite attachments] used on my skeleton within Unity. Have tried approaching the issue with submeshes and so on, but even after the draw orders are revealed and edited in the inspector, the sprites do not actually change Z order in our game.

Is there a way to either:

1) Tag and export/pack individual Images used in the skeleton to their respective texture sheet/atlas?
2) Address the above problem in the least painful way possible :p

Cheers!
UkiTakuMuki
  • Сообщения: 3

Pharan

You just want access to the draw order list?
https://github.com/EsotericSoftware/spine-runtimes/blob/master/spine-csharp/src/Skeleton.cs#L53
The draw order list is just the order that the renderer uses to know which slots attachments to render first and in in what order.
void ChangeOrder () {
Spine.Skeleton skeleton = GetComponent<SkeletonAnimation>().skeleton;
Spine.ExposedList<Slot> drawOrder = skeleton.DrawOrder;
// Do whatever you want with drawOrder.
}
An ExposedList<T> is just a modified List<T> that allows you to access its backing internal array but you can do all the regular List operations on it.
Аватара пользователя
Pharan
  • Сообщения: 5366

UkiTakuMuki

Hi Pharan,

Sorry, I should have said "Unity's Sorting Layer" instead of "Spine's Draw Order"...

For example, I have a character that has a "Rifle" sprite attached to an [Arm Bone]. Another slot attachment on [Arm Bone] is "Rifle_Muzzleflare" sprite. In Spine and Unity, I am able to animate, access the draw orders and edit them perfectly.

But I would like to be able to take the "Rifle_Muzzleflare" sprite and have it move within Unity's Mesh Renderer's Sorting Layers, not just within the character animation's Draw Order.

Right now, in Unity, the character's SkeletonAnimation is set to "Characters" Sorting Layer, and I want to move it out of those bounds and into a different Sorting Layer, like "Roof", which is, in our top-down game, above the "Characters" Sorting Layer. So far we can only seem to edit the Draw Order within the SkeletonAnimation only, which isn't what we need.
UkiTakuMuki
  • Сообщения: 3

Pharan

I think this will be useful:
http://esotericsoftware.com/spine-unity#Sprite-Texture-RenderingZ-Ordering

If you're familiar with Unity, you'll know one MeshRenderer is one whole mesh, and there's no way for one Renderer to have two sorting layers.
To have two meshes and two MeshRenderers, you'll need to separate the skeleton render into parts. That's where SkeletonRenderSeparator comes in.

If you don't want to use that system, you'll have to animate two separate skeletons or align a plain GameObject with a SpriteRenderer with BoneFollower, or whatever.
Аватара пользователя
Pharan
  • Сообщения: 5366

UkiTakuMuki

Thanks very much Pharan!!!
UkiTakuMuki
  • Сообщения: 3


Вернуться в Unity