Possible to save animations created from script as clip files in the project?

I'm not too familiar with editor scripting, so this might be a job more appropriate for an editor script, but:

I regularly create clips from script, for instance: walking backwards (duplicating the walk anim, but setting the speed to -1), upper body only motions (adding mixing transforms for upper-body only animations), etc.

Would it be possible to save this animations as clips in my project?

Forum post.

Should just be able to use AssetDatabase.CreateAsset, followed by SaveAssets:

AssetDatabase.CreateAsset(yourAnimClip, "Assets/MyAnim.anim");
AssetDatabase.SaveAssets();

http://unity3d.com/support/documentation/ScriptReference/AssetDatabase.CreateAsset.html

http://unity3d.com/support/documentation/ScriptReference/AssetDatabase.SaveAssets.html

You could make use of scriptable objects, if you can't create animations yourself. Basically a scriptable object is a class whose types can be saved on disk (.asset).

To make this work you need to create a new class extending ScriptableObject. To create instances of this you should use the editor classes. AssetDatabase hold methods to create new asset files etc. So you could design your own ScriptableObject to contain the data needed to perform your task. Then your own scripts (derived from MonoBehavior) can provide a public field so they can use it:

public MyScriptableObject MyScript;

And you'll be able to bind it directly via the editor. You can also call Resources.Load if you prefer to get them via scripts. ScriptableObjects used with AssetDatabase give you new Asset Types (such as PhysicsMaterial, Texture, and so on). They appear in the project view, just as other assets.

I dont know your exact needs, but if you want to create a group of AnimationClips as an example, here's how such a ScriptableObject could look like:

public class StandardAnimations : ScriptableObject
{
    public AnimationClip walk;
    public AnimationClip stand;
    public AnimationClip idle;
    public AnimationClip attack;
}

You could create several instances of the StandardAnimations, like one for MonsterAnimations and another one for PlayerAnimations. Then just assign either a MonsterAnimation or a PlayerAnimation to your Character script.