Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Question Sprite Resolver with 2D Blend Tree

Discussion in '2D' started by rpie3, Jan 16, 2023.

  1. rpie3

    rpie3

    Joined:
    Jan 7, 2020
    Posts:
    3
    I have set up a sprite library & sprite resolver to animate the sprite on my game object. I have an animation controller set up, with a 2D simple directional blend tree. As you can see in the gif, the animations do work - but any diagonal motion seems to cause the sprite resolver to stop setting the sprite correctly. Is this a limitation of a sprite library/resolver setup? Or is there something I'm missing to allow the blend tree to work properly?
     

    Attached Files:

  2. RafaBriet

    RafaBriet

    Joined:
    Apr 6, 2015
    Posts:
    3
    Hi rpi3,
    Were you able to solve this problem? I have the same problem.
     
  3. rpie3

    rpie3

    Joined:
    Jan 7, 2020
    Posts:
    3
    I have not been able to. Someone else did propose me a workaround, which is to feed the animator values which have been snapped to the direction of the animation you'd like to play. This works, but then the blending based on movement angle has to be done inside your own code, which is a little inconvenient
     
    Xiangting_Su likes this.
  4. RafaBriet

    RafaBriet

    Joined:
    Apr 6, 2015
    Posts:
    3
    I see. I'll try that. Thank you.
     
  5. Xiangting_Su

    Xiangting_Su

    Unity Technologies

    Joined:
    Sep 22, 2020
    Posts:
    246
    @rpie3, thanks for the question! The gif really helps too! It got me curious and so I clarified with a developer.

    So in 21.3 and older, you need to put in some work in order for it to work and this is one way.
    Another way (which is less recommended due to risks involving upgrading) is to update to 22.1 or newer and run the 2D Animation Asset Upgrader tool to upgrade your clips. After this it should work as expected.

    In 22.1 and newer, with the Sprite Hash update in 22.1, Blend Trees should blend as expected as long (as the Animation Clip is using Sprite Hash). Hope this clarifies!
     
  6. rpie3

    rpie3

    Joined:
    Jan 7, 2020
    Posts:
    3
    @Xiangting_Su thank you so much for looking into it and letting me know! Somehow I initially missed your response and just saw it today.

    The project happened to be just for prototyping to see if that setup would work, so I upgraded that project to 22.2.6f1 and ran the animation clips through the upgrader tool as you described. The resolver/blend tree combination does seem to be working exactly as expected now! I really appreciate the detailed response.
     
  7. Xiangting_Su

    Xiangting_Su

    Unity Technologies

    Joined:
    Sep 22, 2020
    Posts:
    246
    Super, that's great to hear! Thanks for letting us know! :D
     
  8. izzanfuad

    izzanfuad

    Joined:
    Dec 7, 2021
    Posts:
    16
    Hi, is this thread still going? Mine's a little bit different, If I just put the animation by itself without using a blend tree it works fine, but if I tried to use a blend tree it won't play. I'm also using the sprite library and resolver asset. Is this also a version problem, or something else??

    • Here's the gif
     

    Attached Files: