How To Access Individual Animation Clips In 1 Animation File

Given an FBX model with 1 animation file containing 30 clips, how do I access the individual animations “knight_sword_out_01”, “knight_combat_mode”, etc, as scriptable sub-clips, rather than simply playing the entire 30 animation clip?

The model and animation seem to import correctly, i.e. I can play the 1 clip, “animated_knight” via “Play Automatically” or via animation.Play() to cycle thru all 30 animations. I tried, e.g. manually defining the individual clips in the FBX Importer Animations section (as in, using the names and frame delimiters from the modeler’s notes, but defining, e.g. an animation “knight_StandingFree” with Start 1 and End 100 and then accessing it in a JavaScript attached to the model results in an error:

“The animation state knight_StandingFree could not be played because it couldn’t be found!
Please attach an animation clip with the name ‘knight_StandingFree’ or call this function only for existing animations.”

The script Animate is attached to the model in the scene and contains:

//   animation.Play("animated_knight");

where I can use “animated_knight” fine if I uncomment it, but not “knight_StandingFree”.

Was I on the right track with splitting the animations manually in FBX Importer?


The instructions in the link above, as well as this work as described. I was not making sure the changes in FBX Importer were being applied to the Project model, and then wasn’t setting the animation names in the scene’s instantiated model in the Inspector under Animations.

I split the animation in Unity instead of splitting the animations manually in FBX. This should explain it.

You were on the right track, yes- make sure that your animation component on your gameObject also has these animations on it! When you update the fbx importer with new animations, any prefabs which use that mesh will not automatically update with the new animations- you have to manually drag and drop them on. The easiest way, I’ve found, is to select all the animations you need to reconnect in the project view, and then drag them straight onto the prefab which needs them. This will let the animation component know about the new animations.