0
\$\begingroup\$

i know that that's is a very old unity issue. I'm doing a 2d pixel art rpg and i want to sprite swap whenever the player gets an armor (helmet,vest,boots...). I created an empty gameobject and childed all armor gameobject. After a long research i found the Unity Sprite Library Asset that can swap the sprites of a category. I have a helmet idle sprites and registering this to the sprite library i can succesfully swap the head helmet. The problem is that when i animate this, i can't swap the sprites because the animations keyframes animates only one sprite. I don't really know how to change by sprite library asset not only the single sprite render but all the sprites in the animation (i have sprite for each keyframe because i update the sprite, i don't use things like 2D bones)

That's the idle player animation: enter image description here

That's the hat animation. enter image description here

That's how i configured the equipment objects (sprite renderer): enter image description here

Is there a way to help with my code?

\$\endgroup\$
5
  • \$\begingroup\$ The sprite library asset should solve that problem. Can you walk us through how you've set it up for your use case? We might be able to help you spot a configuration change you can make to work correctly with your animation. \$\endgroup\$
    – DMGregory
    Aug 19 at 19:05
  • \$\begingroup\$ The sprite library assets only changes my sprite but i have to change all the sprites in the animation keyframes \$\endgroup\$
    – Diaskyyy
    Aug 19 at 20:51
  • \$\begingroup\$ so i don't really know how to change by sprite library asset not only the single sprite render but all the sprites in the animation (i have sprite for each keyframe because i update the sprite, i don't use things like 2D bones) \$\endgroup\$
    – Diaskyyy
    Aug 19 at 20:52
  • \$\begingroup\$ Edit your question to show us what you did. \$\endgroup\$
    – DMGregory
    Aug 19 at 20:57
  • \$\begingroup\$ Done, i simply want to change the keyframes sprites in the second image each time i change the sprite resolver for each sprite \$\endgroup\$
    – Diaskyyy
    Aug 19 at 22:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.