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.

Question [solved] Dotween + animancer = fail. How prewent parameter lock?

Discussion in 'Animation' started by alexandergikalo, Nov 19, 2022.

  1. alexandergikalo

    alexandergikalo

    Joined:
    Oct 24, 2019
    Posts:
    19
    I use DoTween on the project for complex animations that are easier to write in code and an Animancher for sprite animations. I ran into a problem: if you make an Animator animation (used in animancer) for a sprite, then you can’t apply the default sprite (it is variable depending on external conditions) from DoTween.
    I know about the disgusting feature of animation, but they wrote in the topic that a change in the late update helps.
    Changed DoTween to late update (in DoTween parameters), but it did not help. It applies the default sprite, but on the next frame, the animator resets it to empty. Please tell me what to do?
     
  2. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,401
    That's the way all of Unity's animation systems work, not just Animancer. They write the animation value to the animated properties every frame. You need to use LateUpdate to replace the value that was written by the animation every frame.

    You would likely see the same behaviour from DoTween. If you start a tween from the current location to the same location so it isn't really moving move then you set the position once in the middle of the tween, I would expect the tween to apply its value again on the next frame.
     
  3. alexandergikalo

    alexandergikalo

    Joined:
    Oct 24, 2019
    Posts:
    19
    It was worth writing and I solved the problem)))
    Blocking works if the animation is created in the animator, but this is not necessary for the aniancer and it will easily play any animation passed to it. That is, you just need not to add animation to the animator and everything is ok)