Hi,
I’m trying to split a mecanim animation into multiple animations using events. We are using a software that generate an animatorController (unity object) with animationClips. (the plugin is Spine)
We would like to be able to split animations into smaller ones.
As there is only a animatorController and no fbx file, the unity importer inspector is not there so we cannot use this :http://docs.unity3d.com/Manual/FBXImporter-Animations.html
So I tried something like this (as an exemple) :
AnimationClip newClip = new AnimationClip();
EditorUtility.CopySerialized(sourceClip, newClip);
AnimationClipSettings a = new AnimationClipSettings();
a.startTime = 0.05f;
a.stopTime = 0.15f;
AnimationUtility.SetAnimationClipSettings(newClip, a);
AssetDatabase.CreateAsset(newClip, path);
The copied animation is created but AnimationClipSettings.startTime and AnimationClipSettings.stopTime do not seem to work. (it’s only a simple copy)
I’ve then tried with AssetPostprocessor class, because of the ModelImporterClipAnimation where we can choose clipImport.firstFrame , clipImport.lastFrame .
The problem is , it only work with Models with OnPostprocessModel, or sprite/texture/audio, or fbx with OnPreprocessAnimation.
For animator we can use OnPostprocessAllAssets, but it have to be declared as static so there is no assetImporter set and no import done.
Is there a way to create a new animationClip from another AnimationClip, from frame x to frame y ?
Thank in advance
(I already created this thread in 2D forum, but it seems more related to animation stuff, and I did not find anything to delete a thread).