简体   繁体   English

Unity动画列表

[英]Unity Animations List

Good day! 美好的一天!

There is a list of animations: 有动画列表:

Anim1 Anim1

When using this code, only the first one in the list scrolls: 使用此代码时,列表中只有第一个滚动:

Anim2 Anim2

How can I refer to MenuHide (also known as Element1)? 如何引用MenuHide(也称为Element1)?

When using this code, it gives an error: 使用此代码时,会出现错误:

Anim3 Anim3

Anim4 Anim4

Solution found. 找到解决方案。

public void PlayAnimation(string animationName) {    
 foreach(AnimationState state in First) {
    if (state.name == animationName) {
        First.Play(state.name);      
        break;
    }
 }
 }

 PlayAnimation("MenuHide");

Then mark our animation as shown here: https://forum.unity.com/threads/animationclip-must-be-marked-as-legacy.213952/#post-1494616 然后标记我们的动画,如下所示: https : //forum.unity.com/threads/animationclip-must-be-marked-as-legacy.213952/#post-1494616

https://answers.unity.com/questions/577801/animation-must-be-marked-as-legacy.html https://answers.unity.com/questions/577801/animation-must-be-marked-as-legacy.html

Everything worked right for me. 一切都适合我。 I hope this helps someone. 我希望这可以帮助别人。 Sorry for me English. 对不起我的英语。 Thanks to everyone and especially Sergey Mishin from Stackoverflow RU 感谢所有人,尤其是Stackoverflow RU的Sergey Mishin

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM