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. Join us on March 30, 2023, between 5 am & 1 pm EST, in the Performance Profiling Dev Blitz Day 2023 - Q&A forum and Discord where you can connect with our teams behind the Memory and CPU Profilers.
    Dismiss Notice

Question Animation state "normalized" time reports values beyond understanding

Discussion in 'Animation' started by sergiusz308, Dec 1, 2020.

  1. sergiusz308


    Aug 23, 2016
    Hi there, so yeah, I know that this is not "normalized" 0-1 value - docs are saying integer part is number of loops, while fractional is a progress through the loop. Right.

    So I got non-looping clip:


    State settings are following:


    Values I am getting from current animation state of the animator in the coroutine are as follows:


    So - why I got integer part if neither clip nor state are looping?
    Why I got 0,2 as a first value and then it jumps to 3 of integer part?

    Code used to get values:

    Code (CSharp):
    1. yield return new WaitUntil(() =>
    2.                         {
    3.                             GameLogger.Info(true, this.gameObject, $"--Special Attack state: {this.animCurrentState.fullPathHash}, timing: {this.animCurrentState.normalizedTime}");
    4.                             return this.AnimationHasSwitchedToState(this.animSpecialMelee1);
    5.                         });
    7. private bool AnimationHasSwitchedToState(int hash)
    8.     {
    9.         if (this.a != null)
    10.         {
    11.             this.animCurrentState = this.a.GetCurrentAnimatorStateInfo(0);
    12.             return this.animCurrentState.fullPathHash == hash;
    13.         }
    15.         return false;
    16.     }