- Home /
Playing an animation of an .fbx model
Hello all,
I'm working on a game and have a character with a meshfilter component which I load an fbx model on.
mf = (MeshFilter)gameObject.GetComponent(typeof(MeshFilter));
mr = (MeshRenderer)gameObject.GetComponent(typeof(MeshRenderer));
mf.mesh = (Mesh)Resources.Load("Models/character_wizard", typeof(Mesh));
mr.material.mainTexture = (Texture2D)Resources.Load("Textures/wizard", typeof(Texture2D));
The fbx model has multiple clips (in the unity editor I can see these under Clips), but I can't play any clip.
I'm trying to play the animation like this: animation.Play("Run");
But it will just tell me:
The animation state Run could not be played because it couldn't be found! Please attach an animation clip with the name 'Run' or call this function only for existing animations.
Answer by Subzero619 · Jun 21, 2013 at 10:01 AM
Hi, I'll try to help you the best I can.
I am not a pro at these modelling programs.
But what you need to do in Unity3D is click on your character. Go to component > Miscellanous > Animation.
Then in the inspector edit the Size variable to how many animations you have. After that attach all the animations to them and it should work perfectly.
If you don't know how to split animations.
I found this: http://docs.unity3d.com/Documentation/Manual/Splittinganimations.html
Is there a way to attach the animations programmatically? If is add an animation component and do animationComponent.AddClip(); I must give an AnimationClip. But that last part I don't know how to do and how the animations for the right fbx are found.
sorry to necropost here, but I figured it would be better than to ask an entirely new question. I'm pounding my head into my desk, because I am having the same issue. Purchased an animated 3d model from arteria3d, and just can't seem to get the fbx to animate. :( Have manually added the animations (which are already split) into the animation window in the inspector, checked and double checked my syntax, and... nothing but the same error that OP posted.
Your answer
Follow this Question
Related Questions
Another Cinema4D import weirdness 2 Answers
FBX Importing Problem 1 Answer
Animation: Are multiple bindposes in a rig supported? 1 Answer
Mecanim aniamtion error 1 Answer
Trying to use character animation from poser, without any success? 1 Answer