LoginSignup
9

More than 5 years have passed since last update.

Animatorで再生中のAnimationClipのTotal再生時間を取得する

Posted at

Animatorで再生中のAnimationClipのTotal再生時間(Duration?)がどうしても知りたいケースがあったのですが、AnimatorStateInfoのLengthがそれでした。

AnimatorStateInfo currentState = animator.GetCurrentAnimatorStateInfo (0);
float duration = currentState.length;

※MonoBehaviorのvoid Start()内で取得したところ0になってしまったので注意。

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9