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.

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: