- Home /
Animation Event not triggering the string?
Hello, My animation event window looks like this.
And here are my event functions:
void AnimEvent(int num){
Debug.Log("Num "+num);
}
void AnimEvent(string str){
Debug.Log("Str "+str);
}
However, the game only prints out Num 0 every time. If I remove the int function, then the string works fine, but as long as the int function exists, it ONLY sends the event to the int. Am I doing something wrong here?
(Note, I will soon need the int function for other animations, so I can't just remove it)
Comment
Best Answer
Answer by Juice-Tin · Dec 28, 2014 at 11:08 PM
Found out the solution. It only calls 1 function, and so it can be set like this
void AnimEvent(AnimationEvent e){
Debug.Log("Str "+e.stringParameter);
Debug.Log("Num "+e.intParameter);
}
The AnimationEvent class contains all parameters. Leaving this here for anyone else to see, as the animation event documentation is quite outdated and unhelpful.