Action Modules replace one stage of a Character Item Action: firing, attack detection, reload, recoil, allowed use, or feedback. A module is serialized inside the action, rather than attached as another component.

Choose the extension point

Type Responsibility
Character Item Action Complete operation and character/item/inventory/slot/perspective context.
Action Module Group Ordered compatible choices for one stage.
Action Module Stage implementation, lifecycle interfaces, States, and bindings.
Impact Action Result using collision/target context.
Impact Action Condition Source/target acceptance or branch.
Item Effect Item-owner feedback without impact context.

Use the narrowest type that receives the data and lifecycle needed. A group can choose its first enabled main option or invoke every enabled active implementation; adding another row does not make it a fallback automatically.

Add and order modules

  1. Select the main Character Item’s action and expand the relevant group. Usable actions have Trigger/Usable groups; specialized actions add others.
  2. Add a compatible type under Modules, select it, and configure its references, Bindings, and States.
  3. Review execution order and required main-module selection. Explicitly disable alternatives when only one option should run.
  4. After list edits, review IDs and any generated helper objects before removing/rebuilding referenced data.

Selected Debug Use module showing ID, Name, Message, Bindings, and States in the Inspector

Setting/edit Behavior
New module Enabled on, Name empty, declared ID -1; Inspector assigns the new last index.
Reorder Changes priority without renumbering IDs.
Remove Decrements IDs of later rows.
Repeated type Permitted where compatible; may deliberately produce several results.
ID lookup First matching ID; keep IDs unique within the group.

Use type/order selection when a stable numeric contract is unnecessary. Assign prefab/instance helper locations or colliders explicitly when adding modules there; configure both perspective values. Non-prefab Item Manager workflows can create the supplied helpers before saving the result as a prefab.

Start with a working action

Stage Firearm Iron Sword
Trigger Repeat Repeat Combo
Operation/detection Hitscan Shooter, Item Ammo, Simple Clip, Basic Projectile Simple Attack, Hitbox Collision
Result Generic Shootable Impact Generic Melee Impact Module
Feedback/follow-up Muzzle, Shell, Recoil, Crosshairs Spread, Generic Reloader, dry-fire/slot monitoring Attack effects, Simple Recoil, Animator/audio, next combo state

Select hitscan/projectile delivery before configuring ammo/effects/impacts. For melee, align the visible hitbox and active window before adding reactions. See Shootable and Melee.

States, bindings, and lifecycle

States override serialized module values, such as Enabled, damage, or rate. Bindings update a property from a runtime source; an Attribute binding needs its manager/name and valid writable property path. A named State is not a separate activity gate: the active rule reads the resulting properties.

During Play Mode, inspect row status tooltips for active/enabled, enabled/inactive, or disabled. Groups initialize all modules, including disabled rows, with owner/group context, then cache ordered participation lists. Changing Enabled refreshes the caches. Runtime listeners from the base module exist while enabled and equipped.

Pickup, equip, start-unequip, unequip, removal, and destruction pass through the action. Interface invocations skip disabled/inactive modules or select a designated main row. Leave ordinary lifecycle calls to the action and Item Ability so equip, animation, interruption, and networking stay coordinated.

Own nested results and delayed work

Impact Actions start enabled, Delay 0, Allow Multi Hits off, with required collision and optional damage data. Standard Generic Impact modules force invocation; use collision/cast controls for weapon repeat frequency. Custom non-forced callers can use repeat maps and reset at the intended source boundary. Delayed actions own copied contexts and release them during cleanup.

Condition groups test enabled rows in order; an empty list passes. Conditional Impact Action chooses pass/fail results, then optional fail reset affects later surrounding processing. Keep target rules on the reported object/Rigidbody and configure source callbacks as the condition guide describes.

Item Effects receive owner context, with their containing module deciding timing. Use initialized groups, one invocation per intended event, and explicit stop/interruption ownership for persistent results. Remove unused built-in effect rows or provide base-gated custom effects for consistent Enabled behavior. Avoid overlapping delayed invocations unless a custom owner tracks/cancels all callbacks, including revert/lifetime schedules.

Verify and persist

Equip and inspect selected active rows. Fire loaded/dry cycles or swing across a target over several frames; validate main-stage selection and intended hit count. Activate States/change bound sources and compare Inspector values with results. Disable a feedback module, then unequip/re-equip and verify listeners stop/re-register without duplicates.

For missing types, inspect group compatibility. For inactive rows, inspect order, Enabled, and overrides. For duplicate results, inspect all interface participants. For wrong ID retrieval after edits, inspect renumbering/duplicates. For absent impact results, inspect context/conditions before effects. Test interruption and delayed cleanup explicitly.

Authored configuration serializes with the Character Item; custom runtime counters, delays, hit history, or mutable state need explicit save support. NetworkSync defaults false. Built-in networking covers implemented paths only; assign authority/replication for custom results and verify owner/remote views.

Implement a custom module

Use the group’s narrowest base and lifecycle interface:

using Opsive.UltimateCharacterController.Items.Actions.Modules;
using System;
using UnityEngine;
using Opsive.UltimateCharacterController.Items.Actions;
[Serializable]
public class DebugUse : UsableActionModule, IModuleUseItem
{
    [Tooltip("The message to print when the item is used.")]
    [SerializeField] private string m_Message = "Item used";

    public void UseItem()
    {
        Debug.Log(m_Message, CharacterItemAction);
    }
}

Cache references in InitializeInternal; own enabled/equipped listeners through UpdateRegisteredEventsInternal. Use only needed lifecycle hooks and preserve base cleanup. Share logic behind group-specific wrappers when incompatible groups need the same implementation.

GetFirstActiveModule<T>() returns the first enabled active match; InvokeOnModulesWithType<T>() visits all matching participants in group/row order. Keep IDs unique for GetModuleByID. See Item Actions and Usable for the owning operation.