Search Unity

Animator blocking a float if 1 animation as it as a property

Discussion in 'Animation' started by Le_Jo, Apr 11, 2022.

  1. Le_Jo

    Le_Jo

    Joined:
    Jan 24, 2019
    Posts:
    13
    Hi,

    We have an animation A which changes a float X
    We have an animation B which doesn't

    Even if the animation B is playing, when we try to change the float X, X is reset...

    If we remove all the use of X in the animations, it works.
    So it's really the fact that 1 animation using it will block it EVEN if we don't play this specific animation.

    Is it normal ?
    Anyway to by pass it ?

    Please a little help would be appreciated ♥
     
  2. karliss_coldwild

    karliss_coldwild

    Joined:
    Oct 1, 2020
    Posts:
    600
    Yes, it's "normal", that's how Unity animation system work. I have faced this limitation/design choice before. In animator statemachine view you can enable or disable "Write defaults" for specific states (all properties) which helps only in some situations depending on what you want to do, need to be careful with that as it can easily lead to opposite problem. Otherwise I don't know of any good workarounds . It is probably possible to avoid it by adding another layer of indirection and having the animated float only be a hint for desired state so that your script can choose to ignore it if something else indicates that value from different script is more important. But that will likely make the preview worse and would be even more complicated for builtin properties
     
  3. Le_Jo

    Le_Jo

    Joined:
    Jan 24, 2019
    Posts:
    13
    For the readers, I couldn't solve it so I created a float controlled by the animation and I change my main float with the floatAnimation when I need.

    Hope this helped ♥