推荐阅读
大家好,我是佛系工程师☆恬静的小魔龙☆,不定时更新Unity开发技巧,觉得有用记得一键三连哦。
一、前言
在开发中可能会遇到下面的警告:
![在这里插入图片描述](https://img-blog.csdnimg.cn/f4a3b1f2241043dfa497d265b854efff.png)
The AnimationClip ‘RightControl’ used by the Animation component ‘RightControl’ must be marked as Legacy.
意思就是动画组件使用的动画片段必须标记为Legacy。
The AnimationClip ‘XXX’ used by the Animation component ‘XXX’ must be marked as Legacy.
诸如此类的警告,为什么会出现这样的警告,以及如何解决这样的警告呢。
请继续跟随阅读下面的内容。
二、警告出现的原因及解决方式
2-1、警告出现的原因
在Unity 2019.4.38以后的版本,创建Animation Clip的时候会自动创建Animator,并且这个Animator会自动播放这个Animation Clip。
但是在播放的时候,会出现警告,也就是:
The AnimationClip ‘XXX’ used by the Animation component ‘XXX’ must be marked as Legacy.
以及一条:
Default clip could not be found in attached animations list
意思就是说创建的.anim文件其实不能直接用在Animation组件中的。
那怎么解决呢。
2-2、解决方式
1、不使用Animation组件播放.anim动画,使用Animaor去播放.anim动画
2、将这个.anim标记为Legacy。
①随便选中场景中的一个对象,在Inspector面板点击右上角三个点切换成Debug模式:
![在这里插入图片描述](https://img-blog.csdnimg.cn/44c812b724a1488bbd5f44e669d4df35.png)
②选中这个.anim资源,在Inspector视图中勾选Legacy:
![在这里插入图片描述](https://img-blog.csdnimg.cn/3275fec8a0ad4e57a4ae1f614285795e.png)
结束。
三、后记
如果觉得本篇文章有用别忘了点个关注,关注不迷路,持续分享更多Unity干货文章。
你的点赞就是对博主的支持,有问题记得留言:
博主主页有联系方式。
博主还有跟多宝藏文章等待你的发掘哦: