当前位置:网站首页>Process events after unity animation ends
Process events after unity animation ends
2022-08-07 10:02:00 【Yun Xiaochuan】
1.GetCurrentAnimatorStateInfo method to judge animation playback
public class Test : MonoBehaviour{private Animator animator;private AnimatorStateInfo info;void Awake(){animator = GetComponent();}void Update(){info = animator.GetCurrentAnimatorStateInfo(0);if (info.normalizedTime >= 1) // The value of normalizedTime to judge the end of animation playback is 0~1, 0 is the start, and 1 is the end.{gameObject.SetActive(false);}}} 2. Add an animation event after the animation end frame
3. Get the animation duration
/// /// Get the duration method of an animation clip under animator/// /// Animator component/// name of animation clip to get/// public float GetAnimatorLength(Animator animator ,string name){// animation clip durationfloat length = 0;AnimationClip[] clips = animator.runtimeAnimatorController.animationClips;Debug.Log(clips.Length);foreach (AnimationClip clip in clips){Debug.Log(clip.name);if (clip.name.Equals(name)){length = clip.length;break;}}return length;}边栏推荐
猜你喜欢

中国手机持续创新,全面屏再进一步,引领手机创新
![[Punctuality Atom STM32 Serial] Chapter 5 Introduction to STM32 Basics Excerpted from [Punctuality Atom] MiniPro STM32H750 Development Guide_V1.1](/img/04/96eab9886e767f23a060256b254db8.png)
[Punctuality Atom STM32 Serial] Chapter 5 Introduction to STM32 Basics Excerpted from [Punctuality Atom] MiniPro STM32H750 Development Guide_V1.1
![[Go] (1) Go language development environment configuration](/img/ff/17419f43832120dc66c5cd7ca10e97.png)
[Go] (1) Go language development environment configuration

The snowflakes algorithm of a database table

100天精通Andriod逆向——第1天:ADB原理及其常用命令

ctf (easy_md5)

The third community meeting of MASA Stack

xlwings模块(数据保存为xlsx文件)

2022牛客多校联赛第六场 题解

Unity packages webgl and deploys it to the local web server
随机推荐
xlwings模块(数据保存为xlsx文件)
UGUI系列-Dropdown控件研究(Unity3D)
论如何提升学习的能力
项目优化之数据集合优化(Unity3D)
UGUI系列-鼠标移动到按钮上显示信息(Unity3D)
Material Design
装了这几个IDEA插件,基本上一站式开发了!
2022 Niuxue Multi-School League Game 6 Solution
Redis只能做缓存?太out了!
The difference and connection between process and thread
企业内容建站系统 ModStartCMS v4.5.0 后台登录改版,登录安全增强
JDBCUtils工具类的封装
UGUI系列-实现层级菜单(Unity3D)
[Punctuality Atom STM32 Serial] Chapter 5 Introduction to STM32 Basics Excerpted from [Punctuality Atom] MiniPro STM32H750 Development Guide_V1.1
formData
数据库之存储
UGUI系列-屏幕自适应多分配率适配(Untiy3D)
mysql union sorting problem
UGUI系列-列表添加物理效果(Unity3D)
这种调试方法,你值得拥有