How to make a script access animations from a child prefab

Good night. I was having problems to import a fbx from the blender to unity. So here I read one solution that i thought to be good. Create a empty object and put the animation as a child of this object. Also I noticed with this I can change easily the animation with another other easily, just deleting it and dragging a new one. So making the prefab independent from its animation.

The problem is this idea the animation script. Because the animation is not in the empty object, I can’t use the script as I am doing there(I’m based on the animation script of lerpz). So there is a way to make a script access the animation from this “child prefab”? To try to make more clear my explanation, my prefab is something like:

PlataformDog (with all scripts)
|
→ dog (only the converted fbx )
|
→ Armature
|
→ …

Thanks for the attention and sorry about the english mistakes :stuck_out_tongue:

You should find the model at Start with transform.Find, save a reference to its animation and use this reference instead of the property animation. Supposing the model object’s name is “Model”, you could do it this way:

private var anim: Animation; // the animation reference will be saved here

function Start(){
  // find the child object Model and get a reference to its animation:
  anim = transform.Find("Model").animation;
}

// use anim as you would use animation:
  anim.CrossFade("walk");