UNITY AUDIO GUIDE

Add AI sound effects to a Unity game.

Create a focused effect, export it as WAV or OGG, then assign it to an AudioSource in the Unity Editor so it is ready for the interaction that needs it.

0/500

Sign in to generate. Your prompt and settings will be kept.

Start with 30 free credits. Export WAV or game-ready OGG.

The short answer

Import the exported sound into the Unity project, assign it to an AudioSource in the Inspector, and call PlayOneShot from the gameplay event. Keep the AudioSource settings in the Editor so designers can tune volume, pitch and spatial blend without changing code.

A reliable way to start

  1. Make a focused assetGenerate one game event at a time. A sword impact, a menu confirmation and an ambience loop are separate assets with different timing.
  2. Set import and AudioSource optionsDrag the WAV or OGG into Assets, then add an AudioSource to the scene or prefab. Use the Inspector to set the clip and choose 2D or 3D playback.
  3. Trigger the existing sourceReference the configured AudioSource from the component that owns the action. Use PlayOneShot for compact effects so the configured source stays reusable.

Prompt examples

Use these as a starting point, then change the source, action, timing and perspective to fit your scene.

Unity button confirmation

short Unity game button confirmation, precise tactile click with a small warm upward tone, dry compact UI feedback

Sword impact

steel sword striking a wooden shield once, clear wood body and brief metal edge, tight fantasy combat impact

Health pickup

small health pickup, gentle warm rising chime with soft energy sparkle, short readable game feedback

Cave ambience

quiet underground cave ambience, distant water movement and sparse drips, no music or foreground actions, seamless loop

What makes the result more useful

  • Set AudioSource volume and spatial settings in the Unity Inspector so the sound remains tunable without a code change.
  • Use PlayOneShot for UI and transient effects that may overlap; test overlap in the real game loop.
  • Create a small variation group for common actions instead of replaying a single footstep or pickup.

Add the sound to your game

Play a configured one-shot

Add an AudioSource and assign the clip in the Inspector. Attach this component to the object that owns the interaction.

using UnityEngine;

public sealed class UiSoundPlayer : MonoBehaviour
{
    [SerializeField] private AudioSource confirmationSource;
    [SerializeField] private AudioClip confirmationClip;

    public void Confirm()
    {
        confirmationSource.PlayOneShot(confirmationClip);
    }
}

Choose a different footstep each time

Assign all clips in the Inspector. The code only chooses a clip; the AudioSource still controls the mix and 3D settings.

[SerializeField] private AudioSource footstepSource;
[SerializeField] private AudioClip[] footstepClips;

public void PlayFootstep()
{
    var clip = footstepClips[Random.Range(0, footstepClips.Length)];
    footstepSource.PlayOneShot(clip);
}

Frequently asked questions

Should a Unity UI sound be 2D or 3D?

UI feedback is usually 2D. Sounds that belong to an object in the world can use 3D spatial settings, then be tested at gameplay distance.

Where should I adjust sound volume?

Start with the AudioSource in the Inspector. This keeps the scene or prefab editable and lets the team tune the mix without changing the triggering script.

Can I use the same AudioSource for several effects?

Yes for a small local group of transient effects. Separate sources help when you need independent volume, routing or spatial behavior.

Connect AudioMade

Your sounds, inside your AI workspace.

Connect with Codex CLI

Generate a key, then paste the command into your terminal. Requires Node.js/npm and Codex CLI. No installer file needed; npx fetches the MCP package automatically.

Terminal command
codex mcp add audiomade --env AUDIOMADE_API_KEY=YOUR_AUDIOMADE_API_KEY -- cmd /c npx -y audiomade-mcp

Restart your app and open a new conversation after setup.

The copied command contains your private key and may remain in shell history. Keep it private; never commit it to a repository. Generating sounds uses your credits. Existing connections stay active.