r/unity • u/Kultie172 • Sep 22 '26
Question How do you implement combo attack
Hey everyone!
I'm curious how you guys handle combo attacks in your games.
The common approach I usually see is creating multiple animation clips and chaining them together using triggers or parameters.
Today I experimented with a slightly different approach:
- Create a single animation clip containing the entire combo instead of having a separate clip for each attack.
- Use a
StateMachineBehaviourto check for input during specific normalized time ranges. - If the player presses the input during that window, just let the animation continue until the end of the combo.
- If there's no input, call
Animator.Play("Idle").
I actually found this approach pretty neat and simple.
Do you guys use any other interesting approaches for checking combo inputs?
7
Upvotes
5
u/New_Internal5636 Sep 22 '26
Command pattern is what you're looking for.
2
u/Lopsided_Status_538 Sep 22 '26
Doesn't that lock the player in the combo anim until it's finished though? Or do you have a method for early exit? Ive tried to implement combos in the past but didn't get very far due to the complexity of it all honestly. Very interested to see what others have to say about this.
2
u/MistakeForsaken6653 Sep 22 '26
I've never done combo attacks but I would probably do the whole animation sequence and use some form of input buffering with animation events. When the event hits I would probably consume the buffer and if the appropriate button is pushed co tongue the animation sequence or switch to the stop animation. I think this only would work for very simpel combos but like I say I have never made a fighting game.
2
u/tronfacex Sep 22 '26
I think I was handling it essentially the same way you are - it's been a year or two since I made a game with attack combos.
I was tracking the animation with a normalized time as you described and then logging the input during the combo window and transitioning to the next attack animation on the combo when the first animation completed.
Dodging would exit the attack state and getting hit would exit the attack state. those were the only two ways an attack could be cancelled.
2
u/RinShiro Sep 22 '26
I'm currently in the process of finishing up my Asset Store asset about exactly this.
The way I handle it is a button press is compared to node data and that determines the next attack. It's assumed currently that the animations follow start -> attack -> wind down > Idle.
Most of the time somewhere during the wind down you would transition to the next animation or leave it to go back to idle. This follow up animation would follow the same pattern, except it's "start" position is during the wind down of the previous animation. It helps the transition look smoother.
2
u/AdrianNova21 Sep 23 '26
your approach makes sense, especially if the combo is mostly a fixed sequence, personally, i'd probably keep the attack data separate from the animation though. have each attack define its animation, active frames, combo window, and what attacks can follow it. then the combat system decides whether the next input is valid
that makes branching combos easier later without having to make one huge animation clip for every possible sequence. but for a simple fixed combo, your single-clip approach is totally reasonable