Home > other >  Unity Animation AddClip resources add do not come in
Unity Animation AddClip resources add do not come in

Time:09-25

As title, I want to be a tool, all traversal folder. Anim file and then add animation component, to make the precast body, can in the component animation addclip always add is not successful, after the add number getClipCount or 0. But to set the default clip is no problem, I manually pulled apart to him after RemoveClip also does not have what problem, is addclip has not, and would like to ask that what's going on

 
UnityEngine. GameObject obj=(UnityEngine. GameObject) UnityEditor. Selection. ActiveObject;
Animation anim=obj. GetComponent (a);
Int count=anim. GetClipCount ();
AnimationClip newClip=new AnimationClip ();
AnimationClip newCl=AssetDatabase. LoadAssetAtPath (" Assets/Resources/NPCS/shuijiangui/Appear. Anim ", newClip. GetType ()) as AnimationClip.
//EditorUtility CopySerialized (__obj newClip);
Anim. Clip=newCl;

Anim. AddClip (newCl newClip. Name);
//ModelImporter mode=new UnityEditor. ModelImporter ();
Count=anim. GetClipCount ();
  • Related