还是在写小游戏的时候遇到了这个问题,然后就各种搜索啊都没有找到想要的结果,之后偶然发现动画的那个inspector界面居然有个length 后边跟着的数字正好就是该片段的时间,然后我就查了API得到了我想要的结果
Animator anim = GetComponent<Animator>();
Debug.Log(anim.GetCurrentAnimatorStateInfo(0).length);
还是在写小游戏的时候遇到了这个问题,然后就各种搜索啊都没有找到想要的结果,之后偶然发现动画的那个inspector界面居然有个length 后边跟着的数字正好就是该片段的时间,然后我就查了API得到了我想要的结果
Animator anim = GetComponent<Animator>();
Debug.Log(anim.GetCurrentAnimatorStateInfo(0).length);