• Unity
  • Modular Unit with interchangable slots- but how does it work

Related Discussions
...

Let me explain the situation first:
I am working in Spine and I made a unit, lets call it "groupie".
The gameplay is: when theres more of this unit it will look visibly different, changing 3 assets of the units hand/head/collar.

So I have it working in Spine:

  • one main animation of the body
  • folder groupie - with 3 skins each with only three bones.

And now in Unity

But the thing is: the collar needs to be under the headlayer and the twig(headitem) need to be on top of headlayer
Maybe its how I set things up:

  • empty gameobject
  • 1 skeletonanimation body
  • 1 skeletonanimation modular parts

Then i put the modular parts above or below with sorting layering, but obviously it doesnt share the layering I have set up in Spine.

Question:
1 How to I combine interchangable modular parts on a character as an animation in Unity, so the layering stays as originally is intended in Spine.?

Is there a reason your "body" and "modular parts" aren't all on a single Skeleton? Having them on a single skeleton would be the easiest way to set all of the layering up. You would just position the draw order of the Slots (including the slots that are used in the skins) in the Setup Pose.

Lets say you had one Skin that needed the collar-piece to be in front of the Head, and another one that needed to be behind the Head. You could make two Slots, and set the Draw Order on them so that one is behind the Head and one is in front, and then have the Skin only place attachments on the slot with the correct draw order.

Jamez0r a écrit

Is there a reason your "body" and "modular parts" aren't all on a single Skeleton?

Well I am trying to only swap the collar/headitem/handitem. This whole character is already a skin, every slot has skinplaceholders. I just want to change these 3 items for this skin.

Currently I have these skins (this one called "groupie"):

  • Groupie Skin 1
  • Groupie Skin 2
  • Groupie Skin 3
  • Groupie Skin 0 (without collar/head/hand)
    -sub skin collar/head/hand 1
    -sub skin collar/head/hand 2
    -sub skin collar/head/hand 3
  • Charmer Skin1 (completly different skin)

So I DO have those items in same skeleton, but I want the MIX and MATCH, like they have the example files here on Spine.
But how do I get it working in Unity. Thats really not clear to me. I can mix and match all i want in Spine, but it needs to be functional ingame too.

Please see this posting by Nate which lists some important URLs regarding using and combining Skins:
Combining Skins
The topmost URL shows example code for runtimes. Just note that the Unity/C# API uses uppercase first letters at method names, so e.g. addSkin() becomes AddSkin() in Unity.

Hi, I am working in a mobile game which has character customization (Head,Dress,Shoes,Palms). What is the best and efficient practice to make it work.
if we create Skins for every asset like in the twitch stream, won't it take too mush size for atlas or json. this is a huge concern from the development team.
Is there any possible way to store the customisable asset skin in the server and have a combine skin method in in-game.

sorry i don't know where to start a new post in this forum

mariyappan.r a écrit

if we create Skins for every asset like in the twitch stream, won't it take too mush size for atlas or json. this is a huge concern from the development team.

All your skins can be packed to a single atlas texture. The combining skins example Mix and match in the URLs above also uses just one atlas texture, the exported assets can be seen here:

If we add more skin in future one texture atlas is not enough to pack all the images, Right? and we are working for mobile games can't load texture in 8k.

And a kind Request, Can anyone make a tutorial of avatar customization workflow from spine to unity.

You can then still repack the atlas texture at runtime, to combine used attachments of multiple atlas textures to a single texture.

This is all documented in the spine-unity documentation pages:
spine-unity Runtime Documentation: Combining Skins
The spine-unity unitypackage also comes with a lot of example scenes, please have a look at them as well.

13 jours plus tard

Thanks Harald, i will check with the Development Team.


One more Doubt, My Developer has told me this.

If we give them separate Texture atlas for each skin and while combining the skin to create the whole character, we are combining like 4 different textures to create it, and if we need a small attachment from one texture, it will bring the whole Texture atlas. So my Developer is saying its not feasible to use the combine skin method.

What's your call on this?
thank you.

mariyappan.r a écrit

Thanks Harald, i will check with the Development Team.


One more Doubt, My Developer has told me this.

If we give them separate Texture atlas for each skin and while combining the skin to create the whole character, we are combining like 4 different textures to create it, and if we need a small attachment from one texture, it will bring the whole Texture atlas. So my Developer is saying its not feasible to use the combine skin method.

What's your call on this?
thank you.

Is there a reason you can't put all of your images for all of your skins onto a single Texture atlas? The character in your screenshot doesn't look particularly high resolution, couldn't you fit all the images onto one 4k texture?

Jamez0r a écrit

Is there a reason you can't put all of your images for all of your skins onto a single Texture atlas? The character in your screenshot doesn't look particularly high resolution, couldn't you fit all the images onto one 4k texture?

Sorry for the confusion, above screenshot was not shared by me. I am new to Forum discussions in general and i posted my queries in this thread(sorry for that).
we are doing this game for mobile, so we are creating Texture in 2k only. And we don't have like fixed set of costume to be customized, number of costumes may increase in future and its not just about single character, we have multiple characters which do not share the same proportion or height or the same kind of costumes. Each costumes has different shapes so we using Mesh and Weights for particular assets.

6 jours plus tard
mariyappan.r a écrit

If we give them separate Texture atlas for each skin and while combining the skin to create the whole character, we are combining like 4 different textures to create it, and if we need a small attachment from one texture, it will bring the whole Texture atlas. So my Developer is saying its not feasible to use the combine skin method.

I'm not sure I completely understand the problem from what you are saying above.
You don't need to pack all small item skins to one of four big altas textures, you can also leave them as small individual textures if you prefer that. Spine and spine-unity leaves this decision to you. You can pack them beforehand as you like or leave them as is, and pack them later on demand as well.

7 jours plus tard

Hi Harald,
Thanks for the response. How to pack the attachment of an individual item skin alone. if i use Texture packer it asks for the image folder of the skin, which contains all the attachment (includes: dress, Hand Prop, Shoe Etc.. ).If i select the image folder to pack, it packs all the images in the folder and create texture atlas.
Is there a way to pack the attachments of the individual item skin alone?

The following page shows some documentation on the options that you have when using the Spine Texture Packer separately:
Texture Packing - Spine User Guide: Using the Spine Texture Packer separately

Via your folder structure you can control which attachments will end up at a separate Atlas page:
Texture Packing - Spine User Guide: Folder structure
Admittedly, that may be a lot of work when you really want to have only one to three attachments on a single atlas page, so that might be a labor-intensive way to achieve your goal.

You could also specify a small texture atlas Max Width and Max Height to automatically generate many small atlas pages.

mariyappan.r a écrit

If we give them separate Texture atlas for each skin and while combining the skin to create the whole character, we are combining like 4 different textures to create it, and if we need a small attachment from one texture, it will bring the whole Texture atlas. So my Developer is saying its not feasible to use the combine skin method.

Note that by default Unity loads all atlas page textures that are referenced in an Atlas asset. If you require streaming / dynamic loading and unloading, then you will need some additional setup to accomplish loading only the used textures. What is your planned approach in this regard?

If you only want to switch out single attachments, you might perhaps want to use these as normal Unity Sprites, as can be seen in the Spine Examples/Other Examples/Mix and Match example scene. It might not be a good option though when you need to swap out differently sized MeshAttachments that need to be deformed.