Unity中有兩種Animation Clip


http://blog.csdn.net/zzxiang1985/article/details/51291861

 

在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中。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM