UltimateWalrus

Hello,

I'm trying to use Spine for a character customization system in Unity, but it needs to be scalable. We can't just assume everything will fit into one atlas, there may be dozens of atlases in the future.

I assemble a new Skin() called character_skin, by doing AddSkin() with multiple other skins to build a character. If all these skins are from the same SkeletonData, this works perfectly fine when I do skeleton.SetSkin(character_skin).

However, if I feed Skins which aren't in the same SkeletonData into AddSkin, they don't show up, I assume because they're in a different texture/material.

I don't mind if we have to do separate draw calls, we just need to be able to attach skins from a different atlas so we can have customizable characters. My best leads so far are attaching individual sprites to the skeleton with submeshes, or the "SkeletonAnimationMulti" example, but both of these approaches look to be labor intensive and overly complex. I was wondering if someone might know of a simple and easy way. It seems like maybe I'm just missing a line of code somewhere, or a checkbox that would allow me to use multiple SkeletonDatas for one skeleton.

Here is my code, which works great with skins from the same SkeletonData, but doesn't render items from other SkeletonDatas:
SkeletonData skeleton_data = skeleton_mecanim.skeleton.Data;

var character_skin = new Skin("character-base");
character_skin.AddSkin(skeleton_data.FindSkin(base_skin));

foreach( string skin in _skinIds )
if (!string.IsNullOrEmpty(skin) && PlayerSkinManager.skinIdToSkin.ContainsKey(skin))
character_skin.AddSkin(PlayerSkinManager.skinIdToSkin[skin]); //These were stored ahead of time and could point to multiple SkeletonDatas

skeleton_mecanim.skeleton.SetSkin(character_skin); // Apply the combined skin
Thanks for any help!
-Sebastian
UltimateWalrus
  • Postovi: 6

Harald

Please have a look at this forum thread below:
Memory management of character with many outfits
Feel free to ask if anything is unclear, or if it does not fit your requirements.
Avatar
Harald

Harri
  • Postovi: 3914

UltimateWalrus

That was exactly what I needed, thank you! Got it working. Just knowing it should be possible was half the battle
UltimateWalrus
  • Postovi: 6

Harald

Glad to hear, thanks for getting back to us!
Avatar
Harald

Harri
  • Postovi: 3914


Natrag na Unity