Search Unity

  1. We are migrating the Unity Forums to Unity Discussions by the end of July. Read our announcement for more information and let us know if you have any questions.
    Dismiss Notice
  2. Dismiss Notice

Question Animation state "normalized" time reports values beyond understanding

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

  1. sergiusz308

    sergiusz308

    Joined:
    Aug 23, 2016
    Posts:
    237
    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:

    upload_2020-12-1_1-55-47.png

    State settings are following:

    upload_2020-12-1_1-56-6.png

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

    upload_2020-12-1_1-57-15.png

    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.                         });
    6.  
    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.         }
    14.  
    15.         return false;
    16.     }
    17.