- Home /
Making my animation work (error hash does not exist)
So i`m trying to get an animation running with 2 scripts, both of them are in the same namespace. One is called AnimatieController.cs handling the animation The other is character.cs collision trigger and calls the method Trigger in AnimatieController. Sadly it's not working see the error code below:
Parameter 'Hash -1036007686' does not exist.
%|293759743_2|% RedRiders.AnimatieController:Trigger(String) (at Assets/Scripts/AnimatieController.cs:26) RedRiders.character:OnTriggerEnter(Collider) (at Assets/Scripts/character.cs:48)
I`m kinda new towards unity so i might have done something wrong, tho i checked all the names and they are consistent.
The code i use is:
Animator anim;
int Juich = Animator.StringToHash("Juich");
int Idle = Animator.StringToHash("Idle");
// Use this for initialization
void Start()
{
anim = GetComponent<Animator>();
}
public void Trigger(string wat)
{
if(wat == "Juich")
{
anim.SetTrigger(Juich);
}
else if(wat == "Idle")
{
anim.SetTrigger(Idle);
}
}
and
else if (other.gameObject.CompareTag("Finish"))
{
GameObject.Find("Roodbeestje").GetComponentInChildren<AnimatieController>().Trigger("Juich");
}
Comment
Check that yours AnimatorController has exactly the same parameters names. It's case sensitive.