Unity中有兩種Animation Clip

在Unity中,我們有兩種方法創建Animation Clip。


一種(後面簡稱方法一)是選中掛載了Animation組件的GameObject,在Animation窗口中點擊Create New Clip創建出來的Animation Clip。




另一種(後面簡稱方法二)是在Project窗口的空白地方右鍵單擊,選擇Create->Animation創建出來的Animation Clip。




這兩種方法創建出來的都是.anim文件,但是在使用上卻有點不一樣。

選中方法一創建的.anim文件,Inspector窗口只有一個Wrap Mode選項。




而方法二創建的.anim文件的Inspector卻比較複雜。




如果將Inspector切換爲Debug模式,




可以看到方法一的.anim文件的Animation Type是1,




而方法二的.anim文件的Animation Type是2。




兩種.anim文件都可以拖拽進GameObject身上掛載的Animation組件中,






也都可以在Animation窗口中編輯。






但是如果將方法二的.anim文件拖拽進Animation組件,並作爲組件的默認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組件中。




但是方法二的.anim文件卻可以拖拽進Animator窗口,作爲Animator Controller的一個狀態(需要先創建一個Animator Controller),當GameObject身上掛載着Animator,並且Animator引用了這個Animator Controller的時候,這個動畫是可以正常播出的。




而方法一的.anim文件卻無法拖拽進Animator的窗口。也就是說方法一的.anim文件似乎不能用在Animator中。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章