Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Using PSD Importer, what's the best way to edit a sprite without losing bone information?

Discussion in '2D' started by ShrikeDev, Nov 17, 2022.

  1. ShrikeDev

    ShrikeDev

    Joined:
    May 31, 2018
    Posts:
    31
    Currently I have all the layers as smart objects, and when I want to edit a sprite I convert the smart object to layers, edit it, then convert it back to a smart object. I have the PSD importer set to automatic reslice, and layer mapping as use layer name. This feels unreliable and doesn't work every time and not entirely sure if it's on my part. Is this how you're supposed to do it or is there a better way for workflow?
     
  2. Xiangting_Su

    Xiangting_Su

    Unity Technologies

    Joined:
    Sep 22, 2020
    Posts:
    253
    That's a great question! I normally keep my Automatic Reslice checkbox enabled. In my experience, as long as I set my Layer Mapping to Use Layer Name, and kept all my existing layers and their names, everything should be fine. I could add new layers, that should still work fine too.

    Converting Photoshop layers to Smart Objects and even reconverting them back to layers would still keep the rigging information. In situations where I kept some of my layers as Smart Objects (and some as layers), as long as I kept the names the same, that should be fine too.

    However, if I've converted multiple layers into one single Smart Object then switched back to Unity, some of the rigging information would be lost. For example, if I've multi-converted both my Arm_L layer and Arm_R layer at the same time, it would merge both layers into one and generate only one Arm_L Smart Object. Because my Arm_R layer is no longer in my layers, my weighting information on my Arm_R will be gone. To prevent this, I just have to reconvert my Arm_L Smart Object into both their respective Arm_L layer and Arm_R layer, then everything should still work fine.

    Just one small note though, duplicating existing layers then renaming them would cause some issues. I'll be curious to know how your workflow looks like and when does it fail for you.

    Also, what's the reason for converting the Smart Objects to layers whenever you need to edit the Sprite? Have you considered editing the Smart Objects instead? Even though Smart Objects are not directly editable, their contents can still be edited. This is possible by right-clicking on the Smart Object layer and click on Edit Contents. This will open the contents in a separate Photoshop file (or an Illustrator file). Once done and saved, the new changes will also be reflected in the main PSD file. Perhaps this might be easier?
     
    Last edited: Nov 21, 2022
  3. ShrikeDev

    ShrikeDev

    Joined:
    May 31, 2018
    Posts:
    31
    Hello and thank you for your reply! I convert them back to layers because I want to see what I'm editing looks like in relation to the rest of the smart objects, unless there is some way to do that while editing a smart object that I'm not aware of(Edit: I guess a separate window on another monitor would be one way). I'm relatively sure that when I've lost animation data for a layer it's because I was sloppy with something.

    Right now I'm trying to make it so that my player character's lower body works as a sprite-sheet for running, while the upper body works with bone animations to swing her weapons. What do you think the best way to accomplish this would be? Should I have two separate PSD documents, one for upper body and one for lower, and perhaps put the lower body's gameobject as a child of the upper body, or could I just use one document and animate the lower body with sprite swaps? Though I don't think sprite swaps would work because because the running animation needs to change the geometry of the sprite, swaps are only used for skins if I understand right.

    It's a top-down perspective - looks like this currently, only have an idle animation so far.
     

    Attached Files:

    Last edited: Nov 22, 2022
  4. Xiangting_Su

    Xiangting_Su

    Unity Technologies

    Joined:
    Sep 22, 2020
    Posts:
    253
    I see! I get why you have to convert the Smart Objects back to layers before editing now. It's for contextual editing as Smart Object edits in isolation mode i.e. (in a different Photoshop/Source file).
    Thanks for the screenshot! I guess both ways could work. Personally, I would try to put the upper and lower body in the same Photoshop file. It's probably easier when it comes to updating the art and the resolution for different LODs.
    Actually there are many different ways in which we could leverage on Sprite Swap using the Sprite Library. It can be for:
    So it's actually possible to do only a lower body part swap without needing to reskin the entire character, leaving the upper body as it is. This could be achieved by adding the main Sprite Library component to the parent Game Object/Character and the different Sprite Resolver components to the children Game Objects i.e. the lower body. (In the Skinning Editor, you would only have to add bones and weights for the upper body.)

    Even though we don't fully support the frame-by-frame flipbook animation use case, you probably just have to disable all but one variation of the lower body Game Object so you don't see multiple lower bodies/pairs of legs at the same time.

    Also, the PSD Importer helps take care of the pivoting and positioning of the various lower body Sprite parts and automatically reassembles the character in Unity with the correct Order in Layer as per laid out in Photoshop. So everything should look correct out of the box. (But let us know if you encounter any issues.)

    Anyway, feel free to click on the links above to see the examples in our 2D Animation package sample project. Hope this was helpful in some ways. ;)
     
    Last edited: Dec 12, 2022