i'm trying to create a combo system

so basically I’m trying to create a system that when I click the mouse button it does one attack and it returns to the idle state. then have an option to click the mouse button again within a certain time frame of the first attack so then it can do a second attack animation. but when i do it for some reason one mouse click it registered twice and it triggers both of the triggers of attack1 and attack2 for no reason.

a screenshot of my combat code and animator is below.


179406-screenshot-2021-04-18-122604.png

I was facing the same problem. Basicly, this approach is the first that I came up with but… It will not work reliably and probably just won’t work. It is very (!!VERY!!) complicated method having timers and I recommend You to watch this tutorial.

You really will produce many more problems that will very difficult to solve when you adding if statements + timers + animation events.

yeah i watched this tutorial and it did not help what so ever. ill try other ways and see if any of them work but im open to any other suggestions

I recommend you read this article by valar05, since they go over in depth about leveraging mecanim to achieve the combo-behavior you would see in more polished games, like trigger-cache cleaning, animation-event based, weapon trail events, and etc…

I personally replicated this system as well for a small project of mine and it worked beautifully.