Paper Doll for Unity
A downloadable tool
Buy Now$9.99 USD or more
For those of you utilizing character assets with multiple layers like Stardew Valley (skin, hair style, eye color, outfit, etc.), this asset is for you! Quickly and easily swap out textures when your players change their hairstyle, clothing, etc. with a single line of code.
I highly recommend taking a look at the How to Use video, however, text documentation is also included with this asset.
Check out my other assets!
Purchase
Buy Now$9.99 USD or more
In order to download this tool you must purchase it at or above the minimum price of $9.99 USD. You will get access to the following files:
PaperDoll v1.06.unitypackage 509 kB
PaperDoll Addressables Extension v1.08.unitypackage 4.1 kB
Development log
- PaperDoll Addressables Extension Updated28 days ago
- PaperDoll Addressables Extension29 days ago
- Paper Doll for Unity v1.06 Update Release38 days ago
- Paper Doll for Unity v1.05 Update ReleaseFeb 03, 2023
- Paper Doll for Unity Launched!Jan 19, 2023
Comments
Log in with itch.io to leave a comment.
Do you have any ideas on how to make PaperDoll without needing the textures in Resources? I'm developing a multiplayer game, and the dedicated server can optimize away non-read/write textures but only if they're not in a protected Resources folder. So, as a result my container size for the dedicated servers are massive, for a headless instance that coincidentally is never going to need to display the textures.
You should look into addressables. You could likely make this work with minimal recoding using addressables.
Hm, I looked into that and what addressables does is forces you to duplicate the entire Resources directory to a Resources_moved folder. I'm guessing at that point the textures are no longer considered resources. Which means PaperDoll wouldn't be able to access them any longer. I'm guessing what you're recommending is rewriting paperdoll to use addressables instead.
I've set up a fresh project and I'll lean into attempting that. If I get it working I'll send the code your way. Do you have an email I should shoot it over to? Consider any of my changes MIT/X so you can integrate and resell it without restrictions.
ĪWell, what you might have is another class, such as your character class unpack the addressable and then pass it to the paper doll using the set texture method. Or build a script whose sole job it is to unpack these and send it to paper doll then just attach that script to everything that needs it. Email address is bluemanafox@gmail.com, would love to see your final solution to the problem!
P.S. not sure if we're talking about the same thing or not. Addressables doesn't use a resource folder at all, instead it prevents an asset from being loaded until it's needed whereas resources load everything and keeps it in memory. It may not work, sounds like there's a potential flaw with the dedicated server design. Depending, it may be worth it to restructure it if that's possible.
Got it working! :) I made a class called PaperDollAddressable. It works just like PaperDoll except you pass in a string name of the addressable you want to use instead of a resource texture. You'll be able to include it in your product without breaking the old PaperDoll and devs can just pick which one they want to use based on their usecase. I'll clean it up and email it over.
Regarding what I meant before about the Resource folder, when you try to convert a Resource texture to an addressable it will demand that you duplicate the folder as Resource_moved because Addressables cannot be in the Resource.
And, regarding my usecase I am trying to use FishNet + Edgegap for hosting, and their containers are 1 hour limit and 250MB memory constrained for evaluation and 2GB limited for pro. I hit the 250MB memory limit of the container very quickly because I own all the Mana Seed packs and had them in the Resources. And, when you build, Unity marks Resources as required and forces them into the dedicated server builds. I kept adding content and testing my network code which was working great up until I added too much content and the dedicated server stopped working because of the constraint. So, I want to move over to addressables to solve it.
Oh good! I am so glad to hear that solution worked for you. As I said before I believe addressables would 100% resolve your problems then I think for your project and get you away from the resources folder. It will also reduce the overhead and increase performance for your players ;)
In PaperDoll's SetTexture you need to change the line to:
if (!texturePath.Equals("") && !texturePath.Equals(TexturePath))
Currently, that ! is missing on the textureParth.Equals, so if someone tries to swap the sprite texture at runtime it will fail to set the TexturePath.
p.s. Love all of your products, I've grabbed them all. How are things coming on an update for the farmer pack (also they have a wider range of ramps for farmer, so you'd need a new shader pack for that), eye updates and weapons, etc? Also, SpriteImporter probably needs an update soon as they've changed the API again for Unity 6. Looks like they're giving us a lot more control over the importer and they've been refactoring it.
I've made a convenient slider for your material pack:
Also, regarding the shader pack you should probably upload a version for Unity 6 which has the ramps fixed. I fixed them on my side but it'll reduce confusion to just have them set correctly in a separate package download. Sorry for merging all my comments into one on this kind of unrelated thread.
Hey there! Thanks for the reminder about the bug in PaperDoll. I've actually known about it for awhile, as I keep bumping into it in my personal projects. But then I keep forgetting to fix it in the package. So v1.06 is up now.
As for the issue with the materials, Unity is a modularized platform, and ShaderGraph is an independent module separate from version 6. You are correct that the issue has been resolved, but it has actually been resolved regardless of your Unity version. At least it is corrected for me on 2021.3.45f1 && on v6.
In regards to the separate shaders for the farmer base, I've actually been working on this already. However, it will be released as a separate purchasable product. Both the character base and farmer base material projects were a significant time investment going through each and every individual color ramp twice (lit & unlit). I try to keep my assets pretty dirt cheap for folks, so I'll be doing the same for the farmer base shaders.
I like your slider idea, I do almost this exact same thing in my paper doll projects and I really think it's time to incorporate it into the paper doll asset. I call it Master Doll and it is extended from Paper Doll and placed on my base layer that is parented to all other layers. I will probably release this as Paper Doll v1.1 soon.
Lastly, thank you so much for all your support. I personally love these tools for Seliel's assets and find them to be HUGE time savers, and I am glad that so many people enjoy them as well. Alot of them are useable outside of Seliel's assets too and I am always finding uses for these, like Paper Doll in my SHMUP game jams haha. You'll be happy to know that I have a new one I will be releasing later today that is a pinnacle in speeding up my development workflow, keeping me in the editor more vs. in code and also helps greatly reduce coupling. It is essentially ScriptableObject variables & events with OnChange events & optional clamping. It is easily extensible to any value/reference type with just a few lines of code that can be copied from the pre-made templates.
P.S. - Thanks for the heads up on Sprite Importer, I'll keep an eye on it.
Good sir, I paid $100 for a tool in Unity asset store that does part of this and way more complicated. You are a life saver and have made independent devs be able to manage a lot more :D
Thank you so much!
Thank you much, I am glad you like it. :)
Simple, works great and to the point. It even works with my custom animator script.
I made something similar a few years back but it was cumbersome. It required scriptable objects to match up stuff and really just a pain.
Thank you for your service haha.
Not a problem, glad you enjoy it. :)
I am having a slight issue with the frame keeping up when changing sprites. I assume that doesn't happen when using the Animator? Do you happen to know why?
No I haven't seen that. The update is made in LateUpdate so it is done prior to the next frame after the current frame has already been drawn. Are you perhaps targeting high frame rates with your project and the code isn't optimized enough to keep up? I haven't tested the build on games running say, at 240 FPS...
actually, I might just move the LateUpdate into a public method and change it manually. I'll keep you updated
Hello. I bought your package and everything works just fine. But how can I now play the sword animations from the other character sheet?
From the other character sheet? You mean farmer base sprites?
The additional ones from the sword and shield pack for the character base
They are seperate sheets. And when I'm trying to play a slash attack animation, I instead do the "push" animation.
I would have to change between the p1,p2,p3 folders through the script, am I right?
Sorry I was at a memorial celebration for my father the last few weeks. But you are correct you would have to change the paperdoll directory during runtime.
Oh, I'm sorry for you
Thank you, I appreciate that. Let me know if you have any other issues!
I did try your script, and it does not work for me.
I followed your YouTube tutorial and your documentation, and the result is that the child layers are not as animated as they should be. What am I doing wrong? using Unity 2022.3
Child layer:Tree:Folders:
Your sprites need to be in the resources folder. So take that Character folder and move it into a folder called Resources. Don't change the path on paper doll script, you've got that set perfect.
Thanks, that was it! Stupid me :D Thank you!
I just did the same thing wrong... dohhh. Spend an hour debugging the script and settings. Should have just read the comments here ;-)
After renaming the folder, it works. Well worth the $5!
Hi! I'm excited to implement this tool into the current project I'm working on. However, I'm having a bit of trouble.
I've input the correct file path to the folder with my sliced sprite sheets in it and I am receiving the following error:
I'm pretty much trying to achieve what you showcase in the Paper Doll example video. My animations/animation controller for my base sprite renderer are working correctly. I noticed that when I try to input a texture 'sprite' into that slot of the Paper Doll component that I can only put the unsliced version in the slot? See below that a folder-looking file is what's placed there because it won't allow me to place a single image.
Could this be an issue with the file type? My sprites and spritesheets are all PNGs. Here's a screenshot of my the sprite folder I'm directing to for the base:
Is it a problem that my spritesheets are split up? Should they be on one sheet for this to work?
I hope you're able to help me out! Thanks so much for any advice you can provide.
Update:
I did add the Forward Slash to the file path and that did not fix it. I think it has to do with the fact the Replacement Texture slot is only accepting the full spritesheet rather than one of the sliced sprites...When I slice the spritesheets in Unity they turn into 'Sprites' rather than 'Texture2Ds' and maybe that explains why I can't seem to add the sliced images into the Replacement Texture location I think? Unless this is not even the issue and it has to do with my sprites being on multiple spritesheets rather than one.
Apologies for such a long comment - just want to give as much info as possible. Thanks!
So, I've gone through and updated my spritesheets for the base naked character and also a clothing article to test this out and get it working. I've followed the instructions and watched the info video multiple times and it still isn't working for me. I keep getting the following error despite triple-checking the file path. I hope you can help! Thanks in advance for your time.
I have another update. My filepath was wrong because I was specifying the Assets/Resources folders. However, now only the first 6 sprites of each spritesheet are playing. Getting the paperdoll functionality has somehow overridden my animation controller and now it's only playing a group of frames that comes first alphabetically in the spritesheet folders. I'm so close!!! I really hope I can get this working.
Hey, sorry you're having so much trouble with it. We can do a Zoom if you would find that helpful and I can walk you through it. E-mail me at bluemanafox@gmail.com if you're interested, otherwise I can try to help you here but without having my eyeballs on it I don't know how much help I'll be.
I got it working!! This is great. I didn't realize that my base renderer sprites needed to be numbered consecutively starting at 0. I'm quite new at dealing with spritesheets so I wasn't aware that this might be an issue. I thought I would post the final solution in case anyone else runs into the issues I had. Thanks!
Yes, and not just that but you also need to have the same number of sprites in all your spritesheets. So if for example, you have a tool renderer, and there is a frame where that tool does not need to be rendered because the character would be standing in front of it for example (if facing up). You still need to slice the sprite for that empty sprite regardless. If that makes sense :P Glad you got it figured out though!
That makes a lot of sense. Thank you so much for trying to help! I'm so glad I got it working. It's an amazing tool. Thank you!!
Absolutely amazing! This script is a huge time saver for anyone working with a layered sprite system. It's short, simple, and straight to the point which makes using and referencing a breeze! I used this as the foundation for a custom character creator using Seliel's Mana Seed character which has 15 layers, up to ~8 options for each layer, and ~100 animations! Automation is necessary for times like this and this script makes that easy. Thank you, DirePixel. Your work is much appreciated.
Glad you like it! Always appreciate the atta boys :)
Hi, this looks veyr useful, but I do have a question about weapon animations.
Since part of weapon animation is behind player and part is in front, I would make two additional "layers" to paper doll, right? And I would split for example the sword animation file into sword_behind and sword_front files, while keeping the empty sprites so it lines up with basic skin layer and I can swap for bow or whaterver weapon?
Just wanna make sure I understand the capabilities (and limitations, if any). :)
This is a tricky situation, you are both correct and incorrect. So, essentially look at it this way, the Paper Doll is using the frame numbers of the base animation (the character). Since there are no breaks in the base animation, this would require some creativity on your part to achieve in terms of extending the base spritesheet to allow for your scenario to play out. In the end, I feel it would be a dramatic waste of time and resources on your part to achieve. Instead, I would suggest a much simpler solution to approaching the problem, that being a scripted animation helper. Put in animation events at the points where the object must be rendered in front or changed to render behind again. Have a script on your TLA & TLB layers that accept these events and change the sorting layer or Y position of the renderer accordingly (if using custom sort order of (0, 1, 0) on your render pipeline - recommended). But still, use Paper Doll for all the layers, including tool a & b as normal!
I haven't double-checked these scripts, I just wrote them for you in pastebin. So they might require some tweaking. Give these a try to resolve your issue. Hope this helps!
CharacterAnimationHelper.cs
ToolRendererHelper.cs
So with these, just attached CharacterAnimationHelper to your BaseRenderer. Point the animation events in your animation at the OnRenderToolABehind. OnRenderToolBBehind, OnRenderToolAFront, and RenderToolBFront. Then you'll attach ToolRendererHelper to both Tool A & Tool B layers. Lastly, with your Base Layer selected, point the Unity Events firing from the Character Animation Helper script to your Tool A & Tool B layer as appropriate. Again, you may have to adjust the scripts a little for syntax and logical errors, but they are very simple scripts so even a rookie could handle it. :)
Thanks for such a thorough answer! I was really only looking into what can I expect before buying and you pretty much sold your asset to me. :D
Yes, but I want to make sure you have a smooth experience if you choose to purchase. If you do purchase, let me know how those scripts work for you, I may update Paper Doll to include them. I know my opinion may be biased, but for an asset like Mana Seed, this paper doll will make your life a million times easier. Mana Seed is almost unwieldly without it lol, which is why I made it. All the tools I've made I consider essential to stress free Mana Seed game development (Mana Seed Shaders for Unity, Paper Doll, Mana Seed Tools). Together, these tools are a power house. I wish you the best of luck and thank you for your consideration. :)
Hi! While it seems to be the exact thing I'm looking for, I can't get it to work. I set up everything like you did in the instructions and the video but it still says "[Renderer] found no sprites in the spritesheet or spritesheet was not found." I'm trying to figure this out for days but I seem to miss something here. :(
Hi Khavrielle! This occurs when the Paper Doll fails to load a spritesheet texture on start. The cause is going to be either a missing ReplacementTexture in the inspector, or the TexturePath to the ReplacementTexture is incorrect in the inspector. Be sure the TexturePath is a location in the Resources folder. Also, make sure the texture has already been sliced into sprites in the Unity sprite editor.
Hey! Thanks for the quick reply! I checked everything you said and everything seems to be set up correctly, but Unity still complains about not being able to find the Spritesheets/Sprites itself. I'll check it again this evening, maybe I'm just tired or so, haha. Eventually I'll be able to figure this out! // Edit: Unity just doesn't like me, it seems. A restart has solved the problems and now it works fine! Thank you very much for the help and especially the asset! Its fantastic ♥
Lol, hey, been there done that! Usually when I can't figure it out and everything seems sound I say, "I blame it on Unity", and restart.
I was having the same problem. I guess maybe in the script DirePixel concatenates path + texture name and if there's no slash at the end of the path it'll read it completely differently? Idk. All I know is "BaseAnims/part1/4har/" is different from "BaseAnims/part1/4har". Great script once it's working!
Correct. /4har without the ending slash means a file beginning with 4har. The final slash in /4har/ tells the script it is a folder, not a file. It then looks for the name of the attached texture2d in that folder. Forgetting that final / is a no go