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!