Search Unity

Is there a way to replace a sprite in a spritesheet while maintaining "Bind Poses"?

Discussion in '2D Experimental Preview' started by yuch3n, Mar 25, 2019.

  1. yuch3n

    yuch3n

    Joined:
    Sep 26, 2018
    Posts:
    14
    I managed to rig my 2d character up with bones and have her animating. However, now I want to try to change the colour of her clothing. I tried importing the new clothing as a png and replacing the Sprite field of one of the Sprite Renderers in the hierarchy with the new sprite, but now the Sprite Skin component gives me the warning "Sprite has no Bind Poses", and the sprite is being rendered with no mesh deformation at all. Is there a way to swap out images without losing the bind pose information (still a bit unclear of what that is exactly)?
     
  2. Leo-Yaik

    Leo-Yaik

    Unity Technologies

    Joined:
    Aug 13, 2014
    Posts:
    221
    The Sprite that you swap in will need to have the same number of bones influencing the Sprite. This means that you will need to rig the new Sprite the same way you rigged the previous Sprite.

    You can also try selecting the Sprite in Skinning Module Sprite Editor Window, press copy, switch over to the new Sprite, select it and press paste.
     
  3. ArseneySorokin

    ArseneySorokin

    Joined:
    Jan 23, 2013
    Posts:
    53
    Hello,

    Any way to do this in code during run-time?
    Where in the sprite are the bind poses saved and how can I copy them to a different sprite?
     
  4. games4ever

    games4ever

    Joined:
    Jan 23, 2014
    Posts:
    10
    Hello @yuch3n

    What about just replacing the sprite texture itselft for the new one?
     
  5. GoblinGameWerks

    GoblinGameWerks

    Joined:
    Sep 14, 2019
    Posts:
    4
    https://forum.unity.com/threads/changing-animation-sprites.213431/

    this thread has video at min 20:00 with C# script code used to swap out your original sprite sheet for another. The only issue I see here is the number of sprites within your sprite sheet I believe all your sprite sheets need to match in quantity of individual sprites within the sheet... unity loads them instead of your originals and it is all contingent upon the naming structure of the sprites within the sprite sheet.

    So if your new sprite sheet has more sprites like other dangling accessories or an extra arm etc. I don't believe this method will work... or at least I haven't found the workaround yet.
     
  6. LeleUnity

    LeleUnity

    Joined:
    Jul 30, 2016
    Posts:
    47
    I don't understand Why I should copy the rig. According to the manual: "
    1. Add the Sprite Library component to the same GameObject, and assign the new Sprite Library Asset set up in step 3 to the Sprite Library Asset box.

    2. Add the Sprite Resolver component to the same GameObject.
      " and so on...
      I have firstly rigged my character, then I did what I cited from the manual and then I switched a body part, getting Sprite has no binding... WHY? How solve it? Why doing like the manual is not working?
     
unityunity