Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Question Animation and SpriteLibraryAssets not working for me

Discussion in 'Animation' started by scossgrove, Dec 31, 2023.

  1. scossgrove

    scossgrove

    Joined:
    Jan 6, 2016
    Posts:
    35
    Hi,

    I've created a psb and imported this into unity 2d project. I've then rigged the psb by adding bones and associating the corresponding sprites to these bones. Then i've added IK Manager 2d and Limb Solvers 2d to then end of each limb bone. After this i've added a simple idle animation. I am only animating the bones that I have added not the sprites.

    I can run the game and the animation looks fine. Before swapping any sprite and using the original psb sprites all the animation parts are moving correctly.

    I've then added Sprite Resolver and Sprite Library to each sprite of the original PSB. Then when starting the game I dynamically load sprites and categories into the Sprite Library Assets. I can then using the New Input System cycle through each of the sprites causing the "Agent/Player" to have it's appearance change by using the SetCategoryAndLabel(category, label) method against the sprite resolver.

    This is want I want as I would like to have Character customisation and visually see the changes of equipment in game (eg swords and armour, etc).

    The issue I am having is that the animation is not affecting the sprites I am swapping. The "new" sprite remains motionless.

    Can anyone help?

    ** UPDATE **
    My current thoughts are it has something to do with the fact that there is no Skinning Editor process of adding geometry, weight and bone influence to the dynamically added sprites.

    I have tried reading the GetBones and GetBindPoses and GerVertexAttributes from the original sprite in psb. Then when dynamically loading the new sprites into the spriteLibrary setting them, but this leads to some strange things.
     
    Last edited: Jan 5, 2024