An Animator Audio State Set coordinates an item action’s animation variation, optional UCC State, and audio. Equip and unequip sets belong to the Character Item; use, reload, recoil, and impact sets belong to their corresponding action or module.

The set supplies a variation when its owner requests one. Configure the owning action and Animator transitions first; State Name refers to a UCC State on the character, while Item Substate Index contributes to the slot’s Animator parameter.

Alternate two sword attacks

Use an Iron Sword with Animator transitions for Slot<ID>ItemSubstateIndex values 2 and 3:

  1. Select its Melee Action’s enabled combo trigger under Trigger Modules, then expand Use Animator Audio State Set.
  2. Set Selector to Sequence. Keep Reset Delay at -1 to continue across uses, or choose a positive delay to restart after a pause.
  3. Add two enabled entries under Animator Audio States. Set their Item Substate Index values to 2 and 3.
  4. Configure Allow During Movement and Require Grounded for each attack. Keep at least one enabled entry valid for the intended locomotion state.
  5. Assign each entry’s Audio Config and clips under Audio Clip Set. Multiple clips vary the audio within the selected animation entry.
  6. Leave State Name empty for ordinary presentation, or use a named State with Sequence when that variation should temporarily change a character property.
  7. Choose Play Audio On Start Use on the trigger module for start-time playback; otherwise use the owning action’s playback timing.

Simple Combo and Repeat Combo advance the set for chained uses. The trigger and animation-event timing determine attack start, application, and completion.

Inspect a State Set in its owner

The Shield Action example below exposes Impact Animator Audio State Set on the owning component. It uses Sequence, Reset Delay -1, and one enabled entry with Item Substate Index 0. The two-attack sword setup above instead needs its two entries with substates 2 and 3.

Shield Action uses Absorption Factor zero point five, Apply Impact on, Sequence impact selection, a zero point two second completion and Durability as its Attribute name.

Choose a selector

Selector Selection and configuration
Sequence Default selector. Advances eligible entries in order and wraps. Reset Delay defaults to -1, preserving the sequence across elapsed time.
Random Chooses a next variation that may repeat the previous choice. Keep State Name empty; manage any required named State from the owning action.
Sequence Recoil Advances recoil entries in order, with the same reset-delay choices as Sequence.
Random Recoil Random recoil variations may repeat. Keep State Name empty.
Matching Recoil Uses the final numeric Use substate as a zero-based recoil entry index. Keep that value in range, align the recoil rows with it, and leave State Name empty.

Sequence, Random, Sequence Recoil, and Random Recoil honor Enabled, Allow During Movement, and Require Grounded. Matching Recoil directly selects its indexed row, including that row’s audio; use Sequence Recoil or Random Recoil when those filters should determine eligibility.

Recoil selectors add Blocked Recoil Item Substate Index when the hit is blocked. Its default is 20; ensure the Animator supports the selected row’s substate plus that offset.

Entry defaults

Inspector field Default Purpose
Enabled On Includes the row in selectors that filter eligibility.
Allow During Movement On Allows selection while moving.
Require Grounded Off Requires grounded locomotion when enabled.
State Name Empty Temporarily activates a character UCC State for the selection.
Item Substate Index 0 Supplies the row’s variation value to its owner.
Audio Clip Set Unassigned clips Supplies audio when the owner requests playback.

Configure firearm and reload variations

For interchangeable firing variations, select Random on the firearm trigger’s Use Animator Audio State Set. Add an entry for every supported Animator variation and assign its clips. Expect repeated Random choices; use the owner’s start/use timing for audio.

Configure Reload Animator Audio State Set separately. A full-magazine reload usually needs one entry; shell-by-shell reload can advance entries as rounds are inserted. Keep reload and firing substates aligned with their distinct Animator transitions.

Timing, persistence, and ownership

The Character Item or action initializes the set, starts selection, advances it, and combines the returned substate with its own item-state data. It controls the Animator update and the GameObject that emits audio. Audio Clip Set selects a clip from the chosen row; it does not choose an Animator entry.

Equip/unequip use OnAnimatorItemEquip, OnAnimatorItemEquipComplete, OnAnimatorItemUnequip, and OnAnimatorItemUnequipComplete, or configured delays. Use, reload, and impact have their own timing. A state set does not replace those controls or start an action itself. Selection changes and stops deactivate the previous named State where that selector manages State changes.

Selector type, entry settings, Audio Config, and clips serialize with their owner. Runtime selection indexes are not save data: let the owner initialize and select after loading or respawning. Synchronize any gameplay-significant or visually exact random choice through the networking integration; independently running selectors need not agree.

Verify the result

  1. Equip the sword and watch the live slot Item State and Item Substate parameters. Two valid combo attacks should select 2, then 3, with the intended audio and no unrelated named State remaining active.
  2. Test a pause longer than a positive Reset Delay. Confirm the next selection restarts; with -1, confirm wrapping continues.
  3. Test moving and airborne selection. Confirm Sequence/Random variants honor eligibility, and test Matching Recoil separately as direct row selection. Test blocked recoil against the expected offset Animator transition.
  4. Fire repeatedly, then reload. Confirm supported firing variations and audio timing, followed by the separate reload set. For multiplayer, compare the authoritative and remote results.

If an animation stays unchanged, compare the complete live parameter value with the Animator transition. For missing choices, check selector eligibility and advancement. For silent audio, check Audio Config, clips, emitter, and start/use timing. Complete the owning operation and remove unnecessary State Name values when a State remains active.

Custom selection

Derive from AnimatorAudioStateSelector and initialize through Initialize(GameObject, UltimateCharacterLocomotion, CharacterItem, AnimatorAudioStateSet.AnimatorAudioState[], int count). Override current/next index accessors and NextState() for the policy; NextState() reports whether selection changed. Override GetAdditionalItemSubstateIndex() for a context-dependent offset. The owning set exposes selection, index, and audio methods; its owner retains gameplay timing and save/network responsibilities.

Related: