Unity解决动画不可用:The AnimationClip ‘XXX‘ used by the Animation component ‘XXX‘ must be marked as Legacy.

在Unity 2019.4.38.f1c1以上的版本,创建的创建Animation Clip无法使用,作为组件的默认Clip的话,那么游戏运行的时候这个Clip其实是播不出来的,而且Console会报一条

“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组件中

warning

解决方案:

1、2019年以后的版本

选中动画,在Inspector窗口下把动画的Normal模式转换成Debug模式

model
勾选Legacy选项
Legacy
警告消失,动画正常运行

2、2019年以前的版本

在Inspector面板的Rig选项中 Animation Type 选为Legacy

总结:

Unity创建Animation Clip在含动画的fbx导入并将其加入场景后,Animation不存在,手动添加动画时会有警告提示。这个.anim文件却可以拖拽进Animator窗口,作为Animator Controller的一个状态(需要先创建一个Animator Controller),当GameObject身上挂载着Animator,并且Animator引用了这个Animator Controller的时候,这个动画是可以正常播出的。
Animator
所以新版本创建的.anim文件的Inspector比较复杂,最好在Debug模式下勾选Legacy。

猜你喜欢

转载自blog.csdn.net/Prototype___/article/details/124773832