Instantiated character: Animator not working.

Hello folks and thanks for taking the time to read my question.

No I’m Instantiating a character like this:

			GameObject NewEnemy = Instantiate (Resources.Load("Enemy"), NewEnemyPos * TileSize, Quaternion.identity) as GameObject;

And after it has been spawned I try to get it’s animator like this:

private GameObject Enemy;
private Animator EnemyAnimator;
void Start()
    Enemy = transform.FindChild("EnemyGraphics").gameObject;

    EnemyAnimator = Enemy.GetComponent<Animator>();

Where the ‘Enemy’ is the graphics only.
This goes right, but when I try the following in Update:

void Update()
    EnemyAnimator.SetBool("Idle", true);

It gives me the following Error:

Animator has not been initialized
UnityEngine.Animator.SetBool(String, Boolean)

I’ve mad sure that the animator is not null and the AnimatorBoolean ‘Idle’ exists.
Now I’ve seen more people with this problem on several forums, but none of those answers fixed my case.

The Avatar on my animator is null! But I don’t know how to make custom Avatars that the Animator accepts. If this is the problem, is there any way to make custom Avatars? (Not the AvatasMask, for the Animator does not accept those as Avatars).

Thanks in advance and please ask if something is not clear!

Avatar on my animator in null

That is the answer to your problem.You nedd an Avatar for Mecanim to work.Cause it is going to reference the Transformation and oreatations of the Bones and apply the animation to the mesh.

Creating a avatar is really simple and takes no time.


You need to have few specification to create a Human Avatar

1. The Mesh Must contain bones rigged to it and it must be human for retargetting to take place

2.When improting Follow the steps on Unity Docs [here][1]

If you have any doubt feel free to ask