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

    sergiusz308

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