Use UIS audio feedback to confirm a button press, make keyboard or gamepad selection easier to follow, or distinguish inventory outcomes such as a successful pickup from a failed one. UIS uses the shared Opsive Audio Manager; the UIS-specific Button Audio Handler connects that system to a Unity Button, an Action Button, or an Item View Slot without custom code.

Before you begin

Confirm that the scene contains an Audio Manager. The standard UIS setup creates it for you:

  1. Open Tools > Opsive > Ultimate Inventory System > Main Manager.
  2. Open Setup.
  3. Under Scene Setup, select Add Components if the scene has not already been configured.
  4. In the Hierarchy, confirm that the Game GameObject has an Audio Manager component with its default 2D Audio Manager Module.

Choose short clips that are easy to distinguish. A subtle select sound works well while moving between Bag slots; use a firmer click sound when the player submits an action such as using Health Potion.

Create a Button Audio asset

  1. In the Project window, right-click the project-owned folder where you keep UI configuration assets.
  2. Select Create > Ultimate Inventory System > UI > Button Audio.
  3. Name the asset for its role, such as InventoryButtonAudio.
  4. Assign Click Clip and, for Action Buttons, Select Clip.
  5. Leave Click Config and Select Config empty to use the Audio Manager’s default configuration, or assign purpose-built 2D Audio Config assets when these sounds need different mixer, volume, pitch, delay, or source behavior.

The Button Audio asset Inspector with Click Clip, Click Config, Select Clip, and Select Config fields.

Choose the fields by interaction:

Interaction Button Audio field When it plays
Press a Unity Button Click Clip and Click Config The Button invokes its click event.
Submit an Action Button or Item View Slot Click Clip and Click Config The selected control is submitted by pointer, keyboard, or gamepad.
Select an Action Button or Item View Slot Select Clip and Select Config The control becomes selected. A standard Unity Button does not use this sound through Button Audio Handler.

The clip field is the simplest place for one sound. An Audio Config is optional: when a direct clip is assigned, the config controls how that clip plays; when the direct clip is empty, the config can supply its own clip selection. See Audio Config and Audio Manager behavior for the shared playback settings.

Add audio to a control

  1. Select the GameObject that contains the Button, Action Button, or Item View Slot component.
  2. Add Button Audio Handler to that same GameObject.
  3. Assign the Button Audio asset to Button Audio.
  4. Leave Button and Action Button empty if the relevant component is on the same GameObject; the handler finds those references when the scene starts. Assign them explicitly when you want the Inspector to show the intended control.
  5. Apply the change to the project-owned prefab if the control is spawned at runtime.

An Item View Slot Inspector with Button Audio Handler assigned to a Button Audio asset and the Item View Slot referenced as the Action Button.

Use one Button Audio asset across controls that should sound consistent. Create a separate asset for an interaction that needs a distinct cue, such as confirming a purchase or deleting an item. Leave Select Clip empty when selection changes frequently and the extra feedback would be distracting.

Use audio in other inventory interactions

Button Audio Handler is for UI controls. Version 1 also exposes audio at other useful points:

  • Pickup components can use separate clips and Audio Configs for successful, failed, and partial pickups. This makes a full Bag sound different from a successful Health Potion pickup.
  • The built-in Play Audio Item Action uses an Audio Clip Set. Add it to an Item Action Set when invoking an item should produce a sound as part of that action.
  • An Item View Drop Action can play an Audio Clip Set after a drag-and-drop operation. Use it when moving Iron Sword between Bag and Equipment needs confirmation separate from the slot click.

These systems still use the shared Audio Manager, so the same mixer and Audio Config choices can keep UI, item, and pickup feedback consistent.

Verify in Play Mode

  1. Enter Play Mode and open the inventory UI.
  2. Move selection between two Item View Slots with the pointer or navigation input. Confirm that Select Clip plays once when each Action Button becomes selected.
  3. Submit the selected slot or another configured Action Button. Confirm that Click Clip plays.
  4. Press a configured standard Unity Button. Confirm that the click sound plays and that no select sound is expected from Button Audio Handler.
  5. Repeat the interaction quickly and confirm that the volume, mixer output, and overlap behavior match the assigned Audio Config or the default 2D configuration.

Troubleshooting

  • No sound plays and the Console reports that the audio asset is missing: Check Button Audio on Button Audio Handler and assign the asset before entering Play Mode.
  • No sound plays and there is no warning: Check that Button Audio Handler is on the same GameObject as the Button or Action Button, or assign the correct reference explicitly. Also confirm that the clip or its Audio Config contains audio and that the scene has an active Audio Listener.
  • Click works but select does not: Check the control type. Button Audio Handler only connects selection audio to an Action Button; a standard Unity Button connects only its click event.
  • The select sound fires too often while moving across slots: Check whether the Item View Slots select on pointer enter. Leave Select Clip empty or use a quieter clip when hover selection makes the feedback too frequent.
  • UI audio is positional, quiet, or changes with the camera: Check the assigned Audio Config and Audio Source prefab. Screen UI normally uses the default 2D configuration rather than a spatial 3D source.
  • A prefab instance works in one scene but not another: Check that the handler and Button Audio reference were applied to the source prefab and that the other scene completed Scene Setup.

Related:

Developer behavior

ButtonAudioHandler resolves a neighboring Button and ActionButton during Awake when their serialized references are empty. During Start, it registers Button.onClick for the click sound, ActionButton.OnSubmitE for the click sound, and ActionButton.OnSelectE for the select sound. ItemViewSlot inherits ActionButton, so it follows the same submit and select path.

Both sounds are sent through Opsive.Shared.Audio.AudioManager.PlayAtPosition with their respective clip and Audio Config. If no Button Audio asset is assigned at startup, the handler logs a warning and does not register the control events.