首页 > 解决方案 > Unity 动画列表

问题描述

再会!

有一个动画列表:

动画1

使用此代码时,只有列表中的第一个滚动:

动画2

如何引用 MenuHide(也称为 Element1)?

使用此代码时,会出现错误:

动画3

动画4

标签: c#unity3d

解决方案


找到解决方案。

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

 PlayAnimation("MenuHide");

然后标记我们的动画,如下所示: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

一切都适合我。我希望这可以帮助别人。对不起我的英语。感谢大家,尤其是来自 Stackoverflow RU 的Sergey Mishin


推荐阅读