Button OnClick Event won't set Animator Trigger
Hello,
I explain my situation:
In my game the character attack when you press some Buttons in the Canvas. Each button call a method OnClick event. The method called when the your press the button set the desired trigger in the Animator and reset the others like this:
The onClick Event the call this method by tapping the Button is this:
My problem is:
When I click on the Button the the Attack void get called BUT the animator NOT ALWASY animate my character. To make my character animate I have to press the Button multiple times.
BUT, if I call the AttackOnePressed() void like this: if(Input.GetKeyDown(KeyCode.A)) { AttackOnePressed(); } It works every time!
So why the animations not always get triggered by the OnClickEvent but always by the Input.GetKeyDown?