Melee Counter Attack lets a character answer a recently blocked melee strike with a dedicated attack while the original attacker is still directly in front. Use it for a short, deliberate counter window after either a block or parry reaction.

Before you begin

The defending character needs:

  • a Block item ability and an equipped Shield Action capable of starting it;
  • an equipped Character Item with a Melee Action dedicated to the counter attack;
  • a counter animation and Melee Action timing, collision, and impact modules;
  • the attacker included in Character Layer Manager > Enemy Layers; and
  • an attacking opponent whose active Use ability is using the same Melee Action that produced the blocked impact.

Block and parry are both valid entry reactions. Block chooses its parry state when the defending Shield item also has a Melee Action, but Melee Counter Attack does not inspect that parry choice. It only requires that Block started from an impact whose source Item Action was a Melee Action.

Configure Melee Counter Attack

  1. Configure the defending item’s Shield Action and the character’s Block ability first. Confirm a melee hit starts Block before adding the counter.
  2. On the countering Character Item, add or open a Melee Action for the counter. Give it a unique ID so the normal attack and counter can use different animation, collision, damage, and impact modules.
  3. Configure the counter Melee Action’s Trigger, Animator Audio State, Use Event, Use Complete Event, attack timing, collision, and impact modules. A new Usable Action waits for OnAnimatorItemUse, uses a timed 0.05 second Use Complete Event, and starts with Stop Use Ability On Complete Delay 1; align those settings with the counter clip. The action’s use substate becomes the final part of the counter Animator value.
  4. Select the character, expand Item Abilities on Ultimate Character Locomotion, select the plus button, and add Melee Counter Attack.
  5. Keep the inherited player defaults unless a separate counter input is intended: Start Type Button Down, Stop Type Button Up, Input Names Fire1, State Use, and Item State Index 2. Rotate Towards Look Source Target and Block Over UI also start enabled.
  6. Set Slot ID and Action ID to the equipped counter Melee Action. Slot ID starts at -1 and Action ID starts at 0.
  7. Keep Attack Distance at its starting value of 0.6 while validating close melee range, then tune it against the character colliders and desired spacing.
  8. Keep Counter Attack Time Frame at its starting value of 1 second, or shorten it for a strict timing challenge.
  9. Confirm Enemy Layers includes the attacker’s character collider layer. The forward check must hit the same character whose Melee Action caused the block.
  10. If Counter Attack and normal Use share Fire1, place Melee Counter Attack above normal Use in the Item Abilities list. Also keep it above Aim when Item State Index 2 should control the counter animation.
  11. Enter Play Mode and verify the entire sequence: active melee Use on the opponent, Shield impact, Block activation, counter input inside the window, forward range check, and counter hit.

The ability allows duplicate rows but cannot receive another start while active. Use separate rows only for different slots, Action IDs, or inputs.

Understand the counter conditions

Every condition below must be true when the counter input is evaluated:

  1. Block previously activated from a Shield impact whose Source Item Action is a Melee Action.
  2. At that moment, the opponent had an active Use ability whose participating items included that exact Melee Action.
  3. No Use ability was active on the defending character when Block activated.
  4. No other item ability has started on the defending character since the valid Block activation.
  5. The current time is still inside Counter Attack Time Frame.
  6. The counter’s Slot ID and Action ID resolve to at least one Melee Action that can start.
  7. A forward Single Cast reaches a collider in Enemy Layers within Attack Distance.
  8. That collider belongs to the same Ultimate Character Locomotion captured from the blocked Melee Action.

The opponent does not need to remain in its Use ability until the button is pressed. The active Use requirement is checked when Block starts; the later input checks the stored time, forward range, layer, and captured opponent.

Melee Counter Attack stops another active Use ability when it begins and blocks another Use from starting while the counter remains active. This prevents the normal attack assigned to the same button from running over the counter animation.

Block versus parry

The defending Shield item determines whether Block displays Item State Index 8 or Parry Item State Index 9. That presentation does not change counter eligibility. A normal shield block can arm the counter when the incoming source is a Melee Action, and a parry cannot arm it when the incoming source is non-melee.

The released Version 3 Melee Counter Attack class does not notify a separate Counter Attack Response ability; that legacy ability is not present in the released package. Use the counter Melee Action’s collision and Impact modules, or a project-specific reaction system, when the opponent should play a special response.

Choose the counter animation

Melee Counter Attack supplies Item State Index 2 and composes a more specific Item Substate Index from three values:

(opponent Animator Item ID * 1,000,000)
+ (opponent melee use substate * 1,000)
+ counter Melee Action use substate

For example, opponent Animator Item ID 22, opponent use substate 1, and counter action substate 2 produce 22001002.

Keep each segment between 0 and 999 when the Animator decodes this as three three-digit groups. The opponent use substate is accepted only when it is positive, and the last positive value observed during this counter is cached. Before one is observed, the middle segment remains 0; a later zero or negative value does not replace an already cached positive value.

Create Animator transitions for the combinations the game actually supports. A generic middle segment of 000 is a useful fallback when the attacker completes its use before the counter reads the substate.

How it runs

  1. The character’s Shield Action receives an impact and starts Block.
  2. Melee Counter Attack observes the Block activation through the standard item-ability event. It rejects a non-melee impact source and verifies that the opponent is actively using the exact source Melee Action.
  3. A valid block stores the impact time, opponent Melee Action, opponent locomotion, and matching opponent Use ability.
  4. The player presses the counter input. The inherited Use checks UI blocking, Look Source, Slot ID, Action ID, and module eligibility, then this subclass removes every selected action that is not a Melee Action.
  5. The ability rejects an expired window or a forward cast that does not hit the stored opponent on Enemy Layers within Attack Distance.
  6. On success, the counter stops another active Use, activates the Use State, supplies Item State Index 2 and the composed substate, and runs the selected Melee Action’s normal Use, attack, collision, and impact flow.
  7. Use Event and Use Complete Event control the visible counter timing. When the action releases the ability, the stored opponent, time, and substate are cleared.

Starting any other item ability after Block activation clears the stored counter time. If Counter Attack and normal Use share an input, the counter row must therefore be checked first; outside a valid window it returns false and normal Use can proceed.

Verify in Play Mode

  1. Equip the defender’s Shield and counter Melee Action, and keep both characters’ Ultimate Character Locomotion components visible.
  2. Make the opponent start a melee Use and strike the Shield Collider. Confirm Block (Active) appears and the source action is the opponent’s active Melee Action.
  3. Press the counter input within one second while the opponent remains directly ahead and within 0.6 units. Confirm Melee Counter Attack (Active) appears and normal Use does not start.
  4. Confirm the counter Animator uses Item State Index 2 and the expected composed Item Substate Index.
  5. Confirm the counter hitbox and impact occur at the counter Melee Action’s configured timing.
  6. Repeat after waiting longer than Counter Attack Time Frame. Confirm normal Use can proceed but Counter Attack does not.
  7. Repeat with the opponent outside Attack Distance, behind the defender, outside Enemy Layers, and with another enemy collider in front. Confirm every invalid arrangement is rejected.
  8. Repeat with a shootable or other non-melee impact. Confirm Block may react according to the Shield setup but no counter opportunity is armed.
  9. Start another item ability after the melee block but before pressing counter. Confirm the stored counter opportunity is canceled.
  10. Test both a defending block item and a defending item that also has a Melee Action and therefore displays the parry state. Confirm both can arm the counter from a valid melee source.

Troubleshoot Melee Counter Attack

  • Block works but Counter Attack never starts: confirm Block’s Impact Source contains a Melee Action, that exact action belonged to an active opponent Use ability at impact time, and the counter input occurs inside Counter Attack Time Frame.
  • The input performs the normal attack instead: move Melee Counter Attack above normal Use when they share an input. Starting normal Use first clears the stored counter window.
  • The opponent is close but the range check fails: face the captured opponent directly, include its collider layer in Enemy Layers, remove intervening enemy-layer colliders, and tune Attack Distance from its starting value of 0.6.
  • A different nearby enemy prevents the counter: the forward Single Cast must hit the captured attacker. Reposition the characters or correct the extra collider’s layer.
  • The counter row selects a gun, spell, throwable, or general action: it will be discarded. Set Action ID to a Melee Action on the active Character Item.
  • The wrong counter animation plays: verify the opponent’s Animator Item ID, its positive melee use substate, the counter Melee Action’s use substate, Item State Index 2, and the counter row’s list priority.
  • The middle three digits are 000: the opponent Melee Action did not return a positive use substate when the counter queried it. Add the generic fallback transition or keep the opponent’s attack substate available through the counter start.
  • The counter becomes unavailable after Aim, Reload, or another item ability starts: this is expected in the released logic. Any later item-ability activation clears the stored impact time.
  • A non-melee block occurs during a prior valid window: wait for another valid melee block before pressing counter. Released Version 3 clears the stored melee source for the non-melee impact but can leave the earlier timestamp, so mixed impact sources should not share one counter window.
  • The opponent does not play a special response: configure that behavior through the counter Melee Action’s Impact modules or project code. There is no released Version 3 Counter Attack Response ability notification.
  • The attack starts but never completes: check the counter Melee Action’s Use Event, attack timing, Use Complete Event, and Stop Use Ability On Complete Delay exactly as for normal Use.
  • Block explains Shield impacts, block-versus-parry presentation, and the captured Impact Sources.
  • Use explains Slot ID, Action ID, input ordering, Animator timing, and the shared action lifecycle.
  • Melee Action explains Trigger, attack, collision, impact, and recoil modules.
  • Shield Item Action explains the defensive impact that starts Block.
  • Animator Parameters explains Item State Index and Item Substate Index.
  • Default Animator Values lists the supplied item-state conventions.
  • Layer Manager explains the Enemy Layers mask used by the forward cast.
  • Item Abilities explains list order and concurrency.

Developer reference

Attack Distance and Counter Attack Time Frame are protected serialized fields with starting values of 0.6f and 1f; the released class does not expose public properties for them. Melee Counter Attack inherits Use’s Slot ID, Action ID, rotation, UI blocking, participating actions, and lifecycle APIs.

The class cannot receive multiple starts. It overrides CanStartAbility, ShouldStopActiveAbility, ShouldBlockAbilityStart, and GetItemSubstateIndex to add the counter window, Melee Action filtering, opponent cast, Use exclusivity, and composite Animator value.

It listens for OnCharacterItemAbilityActive (ItemAbility itemAbility, bool active) to capture Block activation and clear invalid windows. It emits no unique counter event. Observe its standard item-ability lifecycle or inherited Use events, and handle opponent reactions through the Melee Action impact flow.