1
\$\begingroup\$

I can split the animations of an FBX file into individual takes by script.

However, I have not found a way to do that with .anim files.

Is it not possible to split .anim files into individual takes?

ps: This is the script that I use to split an FBX files into individual takes. However, I can't use the same script for anim files because there is no model importer for an anim file:

ModelImporter nModelImporter = (ModelImporter)AssetImporter.GetAtPath(sPathOfFBXFileInAssetFolder);

nModelImporter.clipAnimations = (ModelImporterClipAnimation[])nList.ToArray(typeof(ModelImporterClipAnimation));
\$\endgroup\$
2
\$\begingroup\$

The reason you can "split" animations in an fbx is because the format itself keeps the different tracks separated, so you technically aren't splitting them, they are already different animations. Your own code should make it pretty clear as you're casting a list of animations into an array of the same type.

You cannot split .anim files as they don't store multiple animation clips, they ARE animation clips.

The only possible way of splitting a single clip into multiple ones that comes to my mind would be to:

  1. Know at what frames to split up the animation
  2. Copy each section you want to be separated and insert it into a new clip which you would then create as an asset file inside of Unity through some Editor Utilities

Here's a link where you can take a look at an example of creating an animation clip through code: https://answers.unity.com/questions/784855/how-to-create-animations-via-script.html

Not sure if my answer satisfies your question, but I hope it can help you towards your goal.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.