Skip to content

Instantly share code, notes, and snippets.

@enpel
Created March 10, 2014 12:50
Show Gist options
  • Save enpel/9464444 to your computer and use it in GitHub Desktop.
Save enpel/9464444 to your computer and use it in GitHub Desktop.
Unityで再生しているアニメーションをスキップする方法 ref: http://qiita.com/enpel/items/5b1b5e001371573098a4
void SkipCurrentAnimation()
{
// 現在再生中のアニメーションクリップ名を取得
// もっとよい方法があれば...
var clipName = "";
foreach(AnimationState state in this.animation) {
if (this.animation.IsPlaying(state.name)) {
clipName = state.name;
break;
}
}
//clipNameが現在の再生クリップと一致していればうまいこと動作する
this.animation[clipName].time = this.animation.GetClip(clipName).length;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment