Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.

    Read our full announcement for more information and let us know if you have any questions.

Feature Request Please make normalizedTime normal...

Discussion in 'Animation' started by Ahverice, Sep 27, 2023.

  1. Ahverice


    Jan 11, 2017
    After scouring the internet, normalizedTime seems to be quite an issue...

    Here's my scenario, I have a melee combat script that runs certain things based on normalizedTime between 0 and 1 right, I understand that above 1 means that's it's loop count and that's not a massive issue, a bit abnormal but not an issue.

    My issue is I'm triggering an animation from my Idle animation, the transition has no exit time and plays instantly as expected, the normalized time I'm receiving is some completely arbitrary number I'm guessing is based off my Idle animation, I could be half way through my swing animation and still receiving values like 4.3 etc etc.. sometimes I receive the correct normalizedTime, like 1 out of 10 times.

    Why can't I play a non-looping animation that instantly triggers and receive the correct normalizedTime between 0 and 1. It almost never works as expected and I'm not alone with this issue.

    Can we please have a normalizedTime with no fancy bits that works the way we would expect something called 'normalizedTime' to work? Re-name the current one to wibblyWobblyTime or something.

  2. Yuchen_Chang


    Apr 24, 2020
    Which function did you call to get your normalized time? I suspect you are getting only the idle state's normalized time; in an animation transition, you will want to use
    to receive next state's normalized time.
  3. Baste


    Jan 24, 2013
    When are you reading off the normalized time?

    If it's on the same frame as you're triggering the animation, it makes sense that you're getting the time of your idle animation. This is because evaluation of the state machine happens after Update has happened. See here.

    You should be getting the correct normalized time in LateUpdate. If you're reading off the state of the animation, that's the correct way to do it anyway, as it's after the animation has resolved.