- Home /
2d Animation sprite swapping
Hello,
I am making an RPG game where different clothes/gear is going to be a major focus. I have fully rigged a character in unity using 2d Animation. This is what my sprite looks like: Because there's going to be lots of combinations of different clothes, i cannot possibly export every combination from photoshop, with the full character. That is why I exported the Torso separately. Immediately you run into 2 problems.
Number 1: you cannot copy paste your bones from the full character, to the torso, you get an exception that says "Target has a different number of sprites". Which is true, because I am trying to just copy/paste the Torso bone instead of all the bones. Seemingly that isn't possible(or at least I don't know how). So what you do is you just manually place the bones that resemble the original as much as possible.
Problem number 2: This is the real issue, the bone that you placed in your new torso sprite, is disconnected from the rest of the skeleton and isn't affected by the weights of the other bones. Example Issue number 1 I can find a workaround for by just manually placing the bones, but what about issue number 2? I cannot for the life of me think of a solution that allows you to swap between different combinations of clothes without breaking something. You'd think that the sprite resolver would just transfer the same bone weights to the other sprites as well but nope. The only way I can think of making it work is by exporting the entire character from Photoshop, for every different piece of clothing that there is. Is this actually the only way to do it? I will end up with like 5000 prefabs that are nearly all pretty much the same thing minus 1 piece of clothing.
Answer by sunnychan1337 · Mar 04, 2021 at 11:39 PM
I found the solution myself. This was UNBELIEVABLY hard to find and the author is the only person that I've seen even talk about this, let alone make a video about it. I haven't tested it myself but this guy shows how you can apply the bone weight data to any sprite. It's simple but literally nobody will tell you how to do this. Video here, go to 2:20: https://www.youtube.com/watch?v=zN9SCRrTVaA
Answer by sunnychan1337 · Mar 04, 2021 at 10:04 PM
Bump, unfortunately never got a reply but maybe someone else will see the thread and know the answer. is it possible to swap sprites somehow, using the sprite resolver without having to import the entire character for every different piece of clothing, but just the piece of clothing itself? Ideally I would just like to replace the chestpiece/pants/boots sprite and just map the existing bone weights to the new sprite. Unless there's a way to do this I will end up with prefabs such as "PlayerCharacterMaleRedPants", "PlayerCharacterMaleBlackpants", "PlayerCharacterMaleDemonHelmet" and so on, rather than just "PlayerCharNaked", "RedPants", "BlackPants", "DemonHelmet".